Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine if Cells in Range are Blank 1

Status
Not open for further replies.

Bass71

MIS
Jun 21, 2001
79
Hi

I'm trying to use variables to determine if a range of cells are completely null. For the life of me I cannot get it right.

Dim i As Integer
Dim j As Integer
Range("U2").Select
i = ActiveCell.Row
j = ActiveCell(8, 1).Row

If Selection.Interior.ColorIndex = 3 Then
ActiveCell.Offset(1, 0).Select
End If
If Range("Ui:Uj") = 0 Then
ActiveCell.Offset(7, 0).Select
End if

Muchas Thanks..............RO
 
First, a question: Are you really trying to test the range U2:U9? This seems like an awfully complex way to derive that range. To be clear, even if "Range("Ui:Uj") = 0" were valid syntax (which you know by now that it isn't), you haven't set it up to be dynamic. It will always equal: U2:U9.

As for testing to see if a range is empty, I would just use COUNTA to test the range.

Something like this:
Code:
If Application.WorksheetFunction.CountA(Range(ActiveCell, ActiveCell.Offset(7, 0))) = 0 Then
...

If you need further help, please provide more details about what end results you are trying to achieve.

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top