Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Adding Counter to column for number of identical file numbers | Excel Discussion (Misc queries) | |||
adding ranges | Excel Discussion (Misc queries) | |||
adding two ranges | Excel Programming | |||
Adding ranges | Excel Programming | |||
Adding a counter to a User Form in Excel | Excel Programming |