View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
popgroove popgroove is offline
external usenet poster
 
Posts: 1
Default how do i incrememnt a cell?

Both of these examples will work.....

For...Next example
Assumption: there could be holes in the data and you need to chec
every cell.
Assumption: if the second cell was duplicate bold the first and not th
second

Public Sub IncrementFor()

Dim x As Integer
For x = 1 To 4000

If ActiveSheet.Cells(x, 4) = ActiveSheet.Cells(x + 1, 4) Then
ActiveSheet.Cells(x, 4).Select
Selection.Font.Bold = True
End If

Next x

End Sub

Do...Loop example
Assumption: there are no holes in the data and you only need to go dow
column 'd' untill a cell is blank
Assumption: if the second cell was duplicate bold the first and not th
second

Public Sub IncrementDo()

Dim x As Integer
x = 1
Do Until ActiveSheet.Cells(x, 4) = ""

If ActiveSheet.Cells(x, 4) = ActiveSheet.Cells(x + 1, 4) Then
ActiveSheet.Cells(x, 4).Select
Selection.Font.Bold = True
End If
x = x + 1
Loop

Mark Wielgus
www.AutomateExcel.co

--
Message posted from http://www.ExcelForum.com