Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Number Cells, Excel 2000 & 2003

Hello,

I have a worksheet that has 4 columns of data. Beginning in Column 1
Row 4 I have numbers in cells then it may be 2 to 8 blank cells down
the column.

How can a macro beginning with Column 1 Row 4 with the number 1 and
count down the column sequentlly skipping the blank cells.

Thank you for your help,
jfcby

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Number Cells, Excel 2000 & 2003

Hi,

A macro could do that in several ways but what do you want it to do as it
counts down the column?

Mike

"jfcby" wrote:

Hello,

I have a worksheet that has 4 columns of data. Beginning in Column 1
Row 4 I have numbers in cells then it may be 2 to 8 blank cells down
the column.

How can a macro beginning with Column 1 Row 4 with the number 1 and
count down the column sequentlly skipping the blank cells.

Thank you for your help,
jfcby


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Number Cells, Excel 2000 & 2003

Hi,

A macro could do that in several ways but what do you want it to do as it
counts down the column?

Mike


I want column 1 cells to have sequential numbers if column 2 same
cells has data in it. If column 2 cell is blank I want column one same
cell blank.

Thank you for your help,
jfcby

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Number Cells, Excel 2000 & 2003

Try this

Sub mersible()
x = 1
With ActiveSheet
lastrow = .Cells(.Rows.Count, "B").End(xlUp).Row
End With
Set myrange = Range("A1:A" & lastrow)
myrange.Select
For Each c In myrange
c.Select
If ActiveCell.Offset(0, 1).Value = "" Then
ActiveCell.Value = x
x = x + 1
End If
Next
End Sub

Mike

"jfcby" wrote:

Hi,

A macro could do that in several ways but what do you want it to do as it
counts down the column?

Mike


I want column 1 cells to have sequential numbers if column 2 same
cells has data in it. If column 2 cell is blank I want column one same
cell blank.

Thank you for your help,
jfcby


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Number Cells, Excel 2000 & 2003

Hello Mike,

Your code worked great!

The only thing was it put a number in column 1 cell if column 2 cell
was empty. I needed it to put a number in column 1 cell if column 2
cell had data in it.

So I modified the code this way:

Sub mersible2()
'This code will put sequential numbers in column 1 if column 2 has
data

x = 1
With ActiveSheet
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
End With
Set myRange = Range("A4:A" & LastRow) '<< Changed to start with
Range("A4:A")
myRange.Select
For Each C In myRange
C.Select
If ActiveCell.Offset(0, 1).Value "" Then '<< Cahnged = to
ActiveCell.Value = x
x = x + 1
End If
Next
End Sub

Thank you your quick response and help,
jfcby

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
Delete row if all cells are blank, Excel 2000 & 2003 [email protected] Excel Discussion (Misc queries) 1 December 14th 07 03:55 PM
Number Cells As Cell Value Changes, Excel 2000 & 2003 jfcby[_2_] Excel Programming 2 February 9th 07 12:00 AM
Does Excel 2000/2003 have a max number of records like '98 has? nobfelt Excel Discussion (Misc queries) 2 July 20th 06 01:27 PM
unlocked cells in excel 2000 now locked when opened in 2003 why? GallanH Excel Discussion (Misc queries) 4 August 31st 05 10:03 PM
In Excel 2000, Cannot edit cells in worksheet created in 2003? hbca4 Excel Discussion (Misc queries) 2 July 26th 05 06:21 PM


All times are GMT +1. The time now is 07:22 AM.

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

About Us

"It's about Microsoft Excel"