Macro help (not the sharpest tool in the shed)

  • Thread starter Thread starter Dano
  • Start date Start date
D

Dano

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!
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top