PDA

View Full Version : Empty Cell Reference



Mykasd
07-06-2007, 06:44 AM
how do you reference an empty cell?


Dim Ctontact Num As Integer, EmptyCellCount As Integer

EmptyCellCount = 0
For j = 1 To ContactNum
If Range("A1").Offset(j, 0) Is EmptyCell Then
EmptyCellCount = EmptyCellCount + 1
End If
Next j


thank you!

Bob Phillips
07-06-2007, 07:06 AM
Depeds,

You can use



IsEmpty(Range("A1").Offset(j, 0).Value)

'or

Range("A1").Offset(j, 0).Value = ""

'or

Len$(Range("A1").Offset(j, 0).Value)>0


but some work if the cell has a formula returning "", some don't.

Mykasd
07-06-2007, 07:25 AM
How do you do a column offset command?
For i = 1 To ColCount
If EmptyCellCount = ContactNum Then
Columns("A:A").Offset(i).ColumnWidth = 5
End If
Next i

Bob Phillips
07-06-2007, 07:31 AM
Columns("A:A").Columns(i).ColumnWidth = 55