Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I need to insert row numbers to a csv file that is generated from a spreadsheet of data. Thought I could user NumberRows() but not sure if this is correct. Could someone tell me the best way to insert row numbers for each row of data. The amount of data varies each time the csv file is generated. Thanks Steve |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This task is easier in the worksheet than VBA. Pick an un-used column and
enter: =ROW() and copy down -- Gary's Student " wrote: Hi, I need to insert row numbers to a csv file that is generated from a spreadsheet of data. Thought I could user NumberRows() but not sure if this is correct. Could someone tell me the best way to insert row numbers for each row of data. The amount of data varies each time the csv file is generated. Thanks Steve |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the reply however it must be done in VBA.
Gary''s Student wrote: This task is easier in the worksheet than VBA. Pick an un-used column and enter: =ROW() and copy down -- Gary's Student " wrote: Hi, I need to insert row numbers to a csv file that is generated from a spreadsheet of data. Thought I could user NumberRows() but not sure if this is correct. Could someone tell me the best way to insert row numbers for each row of data. The amount of data varies each time the csv file is generated. Thanks Steve |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'd insert a new row A.
Then pick out a column that always has data: Option Explicit Sub testme02() Dim wks As Worksheet Dim LastRow As Long Set wks = ActiveSheet With wks .Range("a1").EntireColumn.Insert LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row With .Range("a1:A" & LastRow) .Formula = "=row()" .Value = .Value End With End With End Sub wrote: Hi, I need to insert row numbers to a csv file that is generated from a spreadsheet of data. Thought I could user NumberRows() but not sure if this is correct. Could someone tell me the best way to insert row numbers for each row of data. The amount of data varies each time the csv file is generated. Thanks Steve -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'd insert a new COLUMN A.
Dave Peterson wrote: I'd insert a new row A. Then pick out a column that always has data: Option Explicit Sub testme02() Dim wks As Worksheet Dim LastRow As Long Set wks = ActiveSheet With wks .Range("a1").EntireColumn.Insert LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row With .Range("a1:A" & LastRow) .Formula = "=row()" .Value = .Value End With End With End Sub wrote: Hi, I need to insert row numbers to a csv file that is generated from a spreadsheet of data. Thought I could user NumberRows() but not sure if this is correct. Could someone tell me the best way to insert row numbers for each row of data. The amount of data varies each time the csv file is generated. Thanks Steve -- Dave Peterson -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am getting the message invalid or unqualified reference for the .rows
in the following line. LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row Any ideas? Thanks Dave Peterson wrote: I'd insert a new COLUMN A. Dave Peterson wrote: I'd insert a new row A. Then pick out a column that always has data: Option Explicit Sub testme02() Dim wks As Worksheet Dim LastRow As Long Set wks = ActiveSheet With wks .Range("a1").EntireColumn.Insert LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row With .Range("a1:A" & LastRow) .Formula = "=row()" .Value = .Value End With End With End Sub wrote: Hi, I need to insert row numbers to a csv file that is generated from a spreadsheet of data. Thought I could user NumberRows() but not sure if this is correct. Could someone tell me the best way to insert row numbers for each row of data. The amount of data varies each time the csv file is generated. Thanks Steve -- Dave Peterson -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
All working thanks!!!!
wrote: I am getting the message invalid or unqualified reference for the .rows in the following line. LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row Any ideas? Thanks Dave Peterson wrote: I'd insert a new COLUMN A. Dave Peterson wrote: I'd insert a new row A. Then pick out a column that always has data: Option Explicit Sub testme02() Dim wks As Worksheet Dim LastRow As Long Set wks = ActiveSheet With wks .Range("a1").EntireColumn.Insert LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row With .Range("a1:A" & LastRow) .Formula = "=row()" .Value = .Value End With End With End Sub wrote: Hi, I need to insert row numbers to a csv file that is generated from a spreadsheet of data. Thought I could user NumberRows() but not sure if this is correct. Could someone tell me the best way to insert row numbers for each row of data. The amount of data varies each time the csv file is generated. Thanks Steve -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Insert Row numbers | Excel Discussion (Misc queries) | |||
how do I insert Item numbers | Excel Discussion (Misc queries) | |||
how to insert page numbers | Excel Discussion (Misc queries) | |||
how do I insert an ' in front of many rows of numbers? | Excel Programming | |||
Macro to insert numbers | Excel Programming |