Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
Maasha
 
Posts: n/a
Default numbering macro

In a database of say 10 columns and 100 rows, how do I record a macro
that will



o Insert a new column to the left of column A, then

o in the new column A, number the rows that contain data in
column B.



Note: The numbering should start from 1. Since row 1 has the database
heading & row 2 has the column headings, the numbering (no. 1) should
start from row 3 and continue down to the last row that has data in
column B.

  #2   Report Post  
Posted to microsoft.public.excel.newusers
Bob Phillips
 
Posts: n/a
Default numbering macro


Columns("A:A").Insert
For i = 1 to 100
If Cells(i,"B").Value < "" Then
Cells(i,"A").Value = i
End If
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Maasha" wrote in message
ps.com...
In a database of say 10 columns and 100 rows, how do I record a macro
that will



o Insert a new column to the left of column A, then

o in the new column A, number the rows that contain data in
column B.



Note: The numbering should start from 1. Since row 1 has the database
heading & row 2 has the column headings, the numbering (no. 1) should
start from row 3 and continue down to the last row that has data in
column B.



  #3   Report Post  
Posted to microsoft.public.excel.newusers
Gary''s Student
 
Posts: n/a
Default numbering macro

Try:

Sub Macro1()
Dim i As Integer
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
i = 1
For j = 3 To 100
If IsEmpty(Cells(j, 2)) Then
Else
Cells(j, 1) = i
i = i + 1
End If
Next
End Sub
--
Gary's Student


"Maasha" wrote:

In a database of say 10 columns and 100 rows, how do I record a macro
that will



o Insert a new column to the left of column A, then

o in the new column A, number the rows that contain data in
column B.



Note: The numbering should start from 1. Since row 1 has the database
heading & row 2 has the column headings, the numbering (no. 1) should
start from row 3 and continue down to the last row that has data in
column B.


  #4   Report Post  
Posted to microsoft.public.excel.newusers
Maasha
 
Posts: n/a
Default numbering macro

To Bob Phillips and Gary's Student:
Many thanks for your help - will try out your suggestions later today.
M.

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
Can T Get Macro To Run! Nipper New Users to Excel 2 November 4th 05 04:48 AM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Help with macro looping and color query function kevinm Excel Discussion (Misc queries) 10 May 26th 05 01:25 AM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM


All times are GMT +1. The time now is 04:14 PM.

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"