View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default Why won't this code works

I'm not sure if CELL is a keyword. It's too close for my comfort.
Testing for an empty cell is done differently.

Sub Total_adder()
Dim LR As Long, rng As Range

LR = Cells(Rows.Count, 2).End(xlUp).Row

For Each rng In Range("B2", Cells(LR, 2))
If IsEmpty(rng.Value) Then
rng.Value = "TOTALS"
rng.EntireRow.Font.Bold = True
End If
Next
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"ksnapp " wrote in message
...
here is the code

Sub Total_adder()

Dim LR As Long

LR = Cells(Rows.Count, 2).End(xlUp).Row

Range("B2", Cells(LR, 2)).Select

For Each CELL In Selection
With CELL

If CELL.Value = Empty Then
CELL.Value = "TOTALS"
CELL.EntireRow.Font.Bold = True
End If
End With
Next

end sub

it runs and after it just has the range selected with no changes to the
sheet.

I need it to find all the empty cells in that range(that part works)
and make the the row bold and put the word "TOTALS" in the empty cell.



Thanks in advance


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