I'm using offset function in VBA. But, for example, when I'm in the first row, offset(-5,0) returns an error message. Of course, I can't offset -5 rows when I'm in first row.
How can I check it?
I tried using if rangeEx = range("A1") but it doesn't work.


rangeEx.Offsetrather that justoffset(-5,0)as you have written in your question... If you provide that bit more, we could help...If rangeEx.Column>5 Then rangeEx.Offset(-5,0).Value="test"If rangeEx.Row>5 Then ..