View Single Post
  #3   Report Post  
BigIan
 
Posts: n/a
Default

Hi Ian

Thanks for the reply. I'm not really up on Visual basic so I can only cut
and paste what you've written, although I did change line 3 to: For rin = A1
To A10.

When I ran the macro in a worksheet that was blank apart from a list in
column 1, nothing happened. I don't know if I've put it in the right place in
the Visual basic box, it gave me: Sub MACRONAME() and End Sub and I put it
after End Sub. I had tried it between these two lines but I got an error
saying it was expecting an End Sub.

Am I doing something wrong or missing something here?

Thanks,
Ian




End Sub

"Ian" wrote:

This macro takes data lin A1 to A10 (change rin range to suit), and creates
the data as you illustrated in column B.

Sub script()
rout = 1
For rin = 1 To 10
Cells(rout, 2) = "Fixed line 1"
rout = rout + 1
Cells(rout, 2) = "Fixed line 2"
rout = rout + 1
Cells(rout, 2) = Cells(rin, 1)
rout = rout + 1
Cells(rout, 2) = "Fixed line 3"
rout = rout + 1
Next
End Sub

--
Ian
--
"BigIan" wrote in message
...
I'm trying to use Excel to generate a simple script text file but can't
seem
to get it right. The file follows a fixed repeating pattern like the one
shown below and I'm trying to get Excel to insert a line from a list (A1,
A2,
A3 etc) in the third line of the repeating pattern.
This is the type of file I'm trying to create:

Fixed line 1
Fixed line 2
Cell Info A1
Fixed line 3
Fixed line 1
Fixed line 2
Cell Info A2
Fixed line 3
Fixed line 1
Fixed line 2
Cell Info A3
Fixed line 3

Excel doesn't seem to be able to repeat this type of pattern unless maybe
there's a setting I can change.
Hope somebody can help with this.