Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim RetVal As Variant
If Target.Cells.Count = 1 Then
If Not Intersect(Target, Range("B2:B999")) Is Nothing Or Not Intersect(Target, Range("C2:C999")) Is Nothing Then
If Not IsEmpty(Target) Then
RetVal = Shell("cmdkey /generic:""" & Target & """ /user:""" & Target.Offset(0, 1) & """ /pass:""" & Target.Offset(0, 2) & """", 1)
RetVal = Shell("c:\Windows\System32\mstsc.exe /admin /v:" & Target, 1)
End If
End If
End If
End Sub
Please try this code,
IP's of servers are located in column B and C, then Username and Passwords are in column D and E.
After double clicking the IP the correct username and password credentials are stored, then RDP is launched.
-
Proposed as answer by
guGuuuMy
23 hours 27 minutes ago
-
Marked as answer by
Emi Zhang CHNMicrosoft contingent staff, Moderator
23 hours 3 minutes ago