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

Hello,

How can the following macro be modified to skip blank cells:

Sub NumberCellsValue()

Dim LastRow As Long
With ActiveSheet

Columns("A:A").Select
Selection.Insert Shift:=xlToRight
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Font.Bold = False
Selection.ColumnWidth = 5

LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
.Range("a1").Value = 1
With .Range("a2:a" & LastRow)
.FormulaR1C1 = "=IF(RC[1]=R[-1]C[1],R[-1]C+1,1)"
.Value = .Value
End With
.Range("a:a").NumberFormat = "000"
End With
Range("A1:A3").ClearContents
Range("A1").Select
End Sub


Thank you for your help,
jfcby

 
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, Excel 2000 & 2003 jfcby[_2_] Excel Programming 4 July 11th 07 11:22 PM
Number Cells As Cell Value Changes, Excel 2000 & 2003 jfcby[_2_] Excel Programming 2 February 9th 07 12:00 AM
I want to copy a formula n Excel but skip any blank cells Ann Excel Worksheet Functions 1 December 12th 05 06:55 PM
How do I skip blank cells when copying over a range of cells? tawells Excel Discussion (Misc queries) 2 June 7th 05 09:36 PM


All times are GMT +1. The time now is 03:53 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"