ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro help (not the sharpest tool in the shed) (https://www.excelbanter.com/excel-programming/416987-macro-help-not-sharpest-tool-shed.html)

dano

Macro help (not the sharpest tool in the shed)
 
I was wandering€¦ hoping if someone could help me with a macro.

In excel I have a list of IPs in a column like this:


10.162.164.82
10.162.164.84
10.162.164.85
10.162.164.87
10.162.164.89

There could be hundreds of them.

I need to add these rows in between each IP. Like this:

10.162.164.81
WAIT ""
SEND "ftp-config: 0\m"
WAIT ""
SEND "set-cmnty-name: MVHU\m"
WAIT ""
SEND "exit"
WAIT ""
SEND "Y"
10.162.164.84
WAIT ""
SEND "ftp-config: 0\m"
WAIT ""
SEND "set-cmnty-name: MVHU\m"
WAIT ""
SEND "exit"
WAIT ""
SEND "Y"

And so forth. Can someone help me?
I think I could figure out how to modify the script once I had it (ie
different lines of text and/or more or less lines of text) I would greatly
appreciate it if you could share what so easily comes to your mind that which
is having trouble getting through my thick skull!


Bernie Deitrick

Macro help (not the sharpest tool in the shed)
 
Dano,

We'll sharpen you right up....

Put your eight lines:

WAIT ""
SEND "ftp-config: 0\m"
WAIT ""
SEND "set-cmnty-name: MVHU\m"
WAIT ""
SEND "exit"
WAIT ""
SEND "Y"

into a range of cells - let's say, E1:E8. Then with you list of IP is
column A, starting in row 1, run this macro:

Sub InsertCode()
Dim i As Long
For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
Range("E1:E8").Copy
Cells(i + 1, 1).insert xlShiftDown
Next i
End Sub

HTH,
Bernie
MS Excel MVP


"Dano" wrote in message
...
I was wandering. hoping if someone could help me with a macro.

In excel I have a list of IP's in a column like this:


10.162.164.82
10.162.164.84
10.162.164.85
10.162.164.87
10.162.164.89

There could be hundreds of them.

I need to add these rows in between each IP. Like this:

10.162.164.81
WAIT ""
SEND "ftp-config: 0\m"
WAIT ""
SEND "set-cmnty-name: MVHU\m"
WAIT ""
SEND "exit"
WAIT ""
SEND "Y"
10.162.164.84
WAIT ""
SEND "ftp-config: 0\m"
WAIT ""
SEND "set-cmnty-name: MVHU\m"
WAIT ""
SEND "exit"
WAIT ""
SEND "Y"

And so forth. Can someone help me?
I think I could figure out how to modify the script once I had it (ie
different lines of text and/or more or less lines of text) I would
greatly
appreciate it if you could share what so easily comes to your mind that
which
is having trouble getting through my thick skull!





All times are GMT +1. The time now is 02:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com