• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA Copy and paste column data in multiple rows for multiple conditions

Rajender

Member
Hi All,

I have worksheet where I have a below 2 main sheets :-

1) Code list : having example list of 1 codes which is required to copy for all the different IP's

2) IP list : for different criteria.

currently I am taking example of 2 example :-

1) MW : First I go to code list and there in cell A4 I found MW codes which I needs to repeat as per given list in IP list in current case MW IP list is from A3 to last row :-

Output :- I bold highlighted figure only be change according to number of IP's mentioned in IP list sheet and paste all the codes generated for all the IP's in MW sheet from range A13.

crt.Screen.Send "telnet 172.22.197.73" & chr(13)
crt.Screen.WaitForString "Password: "
crt.Screen.Send "rajender" & chr(13)
crt.Screen.Send "enable" & chr(13)
crt.Screen.WaitForString "Password: "
crt.Screen.Send "rajender" & chr(13)
crt.Screen.Send "show mac-address-table dynamic" & chr(13)
crt.Screen.Send "exit" & chr(13)
crt.Screen.WaitForString "[u0039853@sam " & chr(126) & "]$"

crt.Screen.Send "telnet 172.22.96.254" & chr(13)
crt.Screen.WaitForString "Password: "
crt.Screen.Send "rajender" & chr(13)
crt.Screen.Send "enable" & chr(13)
crt.Screen.WaitForString "Password: "
crt.Screen.Send "rajender" & chr(13)
crt.Screen.Send "show mac-address-table dynamic" & chr(13)
crt.Screen.Send "exit" & chr(13)
crt.Screen.WaitForString "[u0039853@sam " & chr(126) & "]$"

and so on.............

2) Now another one I need the solution is for MPA because here multiple changes required :-

Example : In code list under MPA Dynamic : codes are mentioned which I needs to repeat for all the list which is mentioned in IP list under MPA dynamic list.

crt.Screen.Send "ssh L1PE-ANT-11" & chr(13)
crt.Screen.WaitForString "u0039853@l1pe-ant-11's password: "
crt.Screen.Send "singhnegi" & chr(13)
crt.Screen.WaitForString "<L1PE-ANT-11>"
crt.Screen.Send "scre 0 temp" & chr(13)
crt.Screen.Send "dis mac-address dynamic verbose" & chr(13)
crt.Screen.WaitForString "<L1PE-ANT-11>"
crt.Screen.WaitForString "<L1PE-ANT-11>"
crt.Screen.Send "quit" & chr(13)
crt.Screen.WaitForString "[u0039853@sam " & chr(126) & "]$"

crt.Screen.Send "ssh L1PE-BOR-12" & chr(13)
crt.Screen.WaitForString "u0039853@l1pe-ant-11's password: "
crt.Screen.Send "singhnegi" & chr(13)
crt.Screen.WaitForString "<L1PE-BOR-12>"
crt.Screen.Send "scre 0 temp" & chr(13)
crt.Screen.Send "dis mac-address dynamic verbose" & chr(13)
crt.Screen.WaitForString "<L1PE-BOR-12>"
crt.Screen.WaitForString "<L1PE-BOR-12>"
crt.Screen.Send "quit" & chr(13)
crt.Screen.WaitForString "[u0039853@sam " & chr(126) & "]$"

and so on................ and paste in sheet MPA dynamic.

Below is the link to sample file

https://onedrive.live.com/redir?resid=393CD98CEE2A349F!128

Thanks in advance for your valuable assistance.

Regards,

Rajender
 
Back
Top