![]() |
Insert row numbers
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 |
Insert row numbers
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 |
Insert row numbers
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 |
Insert row numbers
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 |
Insert row numbers
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 |
Insert row numbers
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 |
Insert row numbers
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 |
All times are GMT +1. The time now is 03:18 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com