Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Row numbers Gene Augustin Excel Discussion (Misc queries) 3 February 24th 09 08:20 AM
how do I insert Item numbers EJ Jacques Excel Discussion (Misc queries) 1 May 24th 08 12:30 AM
how to insert page numbers Mylo Excel Discussion (Misc queries) 1 August 5th 05 11:19 AM
how do I insert an ' in front of many rows of numbers? jszuch Excel Programming 2 April 25th 05 02:52 PM
Macro to insert numbers Richard[_15_] Excel Programming 6 August 1st 03 07:06 AM


All times are GMT +1. The time now is 12:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"