Amandine FAURILLOU
Amandine FAURILLOU

Reputation: 612

VBA Error 424 with Empty

I have tried looking for questions with the error 424, but I didn't find any that matched my situation.

I am getting a 424 error on the 3rd line :

For icount = 2 To no_items
    If hid.Cells(icount, 1).Value > 0 Then
        'If hid.Cells(icount, 1).Offset(-1).Value Is Empty Then
            'hid.Cells(icount, 1).Value = 1
        'Else
            hid.Cells(icount, 1).Value = 1 + hid.Cells(icount, 1).Value
        'End If
    End If
Next

My declaration is as follow :

Dim hid As Worksheet
Set hid = ThisWorkbook.Worksheets("Hidden")
hid.Visible = True

Before, I had the same error on line 2 with :

If hid.Cells(icount, 1) is not empty Then

I don't understand why there is an error, everything is defined the way it should. Can you help me please?

Upvotes: 0

Views: 789

Answers (1)

Shai Rado
Shai Rado

Reputation: 33692

Your syntax used for Not ISEmpty is not correct, you need to change your line of :

If hid.Cells(icount, 1) is not empty Then

To:

If Not IsEmpty(hid.Cells(icount, 1)) Then

Upvotes: 1

Related Questions