View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
wmureports wmureports is offline
external usenet poster
 
Posts: 14
Default Adding a counter to ranges

worked like a charm thanks.


Norman Jones wrote:
Hi W,

Perhaps something like:

'=============
Public Sub Tester001()
Dim counter As Long

For counter = 1 To 20
ActiveSheet.Cells(counter, "A").Value = counter
Next counter
End Sub
'<<=============



--
---
Regards,
Norman



"wmureports" wrote in message
oups.com...
What i want to do is insert data into a range of rows. But instead of
staticly typing the rows I want them to be determined dynamically
through a counter variable. Heres and example of my code.

Dim counter As Integer

counter = 0

Do While counter < 20
counter = counter + 1

ThisWorkbook.Worksheets("Sheet1").Range("A1:A20") = counter
Loop


So instead of A1:A20 It will be A*counter value*:A*counter value*. My
problem is I dont know the proper syntax to add the actual counter
variable into to range