Listing Version of the Big Numbers Procedure That Terminates with the Exit Do Statement If the Current Cell Isnt a Number

Sub BigNumbers2()

Dim rowNum As Integer, colNum As Integer, currCell As Range

' Initialize the row and column numbers rowNum = ActiveCell.Row colNum = ActiveCell.Column

' Get the first cell

Set currCell = ActiveSheet.Cells(rowNum, colNum)

' Loop while the current cell isn't empty

Do While currCell.Value <> 1111

1 Is it a number?

If IsNumeric(currCell.Value) Then

If currCell.Value >= 1000 Then

' If so, color it magenta currCell.Font.Color = VBAColor("magenta") End If

' Otherwise, exit the loop Else

Exit Do End If

' Increment the row number and get the next cell rowNum = rowNum + 1

Set currCell = ActiveSheet.Cells(rowNum, colNum)

Loop End Sub

0 0

Post a comment