Hello,
I just started getting this error today.
I'm building several macros that deal with Conditional Formatting (so far 20). They all use the following code to get the first empty cell in column A, which I'm using as my LastRow variable.
It wasn't until I got to Sheet 7 is when this issue occured. It's been persistent with any new Sheets I create. I even created a whole new workbook and the same issue occurred. However, this code runs flawlessly in Sheets 1 thru 6 in my VBA Testing workbook.
Here's a phenomenon to say the least:
Cell A21 is breaking the code in Sheet 7+. Here's why:
I can populate cells up to A20 and the code runs successfully.
Excel HAPPY
If I populate A21, the code breaks and throws that run-time error about how there are no cells.
Excel NOT Happy
If I populate A22 down (after clearing A21), the code runs successfully.
Excel Happy Again
I suspected some sort of corruption, so I ruled out memory, hard drive, and OS corruption.
I even did a fresh install of O365.
I'm stumped. This issue is nothing shy of an irritating inconsistency.
On the topic of 'cell", I noticed too, that I am unable to run any code that uses 'cell'. Mainly loops I believe; like this one:
This is just to serve as a potential symptom to my main issue.
Has anyone seen anything like this before?
Thanks for any insight.
I just started getting this error today.
I'm building several macros that deal with Conditional Formatting (so far 20). They all use the following code to get the first empty cell in column A, which I'm using as my LastRow variable.
It wasn't until I got to Sheet 7 is when this issue occured. It's been persistent with any new Sheets I create. I even created a whole new workbook and the same issue occurred. However, this code runs flawlessly in Sheets 1 thru 6 in my VBA Testing workbook.
VBA Code:
Sub GetLastRow()
Dim LastRow As Long, DataRange As Range
With ActiveSheet
LastRow = .Range("A2:A" & Rows.Count).SpecialCells(xlCellTypeBlanks).Offset(-1).Row 'Get first empty cell in column A -1
Set DataRange = .Range("A3:A" & LastRow)
MsgBox DataRange.Address
MsgBox "Last Row is " & LastRow & " on Sheet: " & ActiveSheet.Name
End With
End Sub
Here's a phenomenon to say the least:
Cell A21 is breaking the code in Sheet 7+. Here's why:
I can populate cells up to A20 and the code runs successfully.
Excel HAPPY
If I populate A21, the code breaks and throws that run-time error about how there are no cells.
Excel NOT Happy
If I populate A22 down (after clearing A21), the code runs successfully.
Excel Happy Again
I suspected some sort of corruption, so I ruled out memory, hard drive, and OS corruption.
I even did a fresh install of O365.
I'm stumped. This issue is nothing shy of an irritating inconsistency.
On the topic of 'cell", I noticed too, that I am unable to run any code that uses 'cell'. Mainly loops I believe; like this one:
This is just to serve as a potential symptom to my main issue.
VBA Code:
Sub Macro1()
Dim ws As Worksheet
Set ws = ActiveSheet
For Each cell In ws.Columns(1).Cells
If IsEmpty(cell) = True Then cell.Select: Exit For
Next cell
End Sub
Has anyone seen anything like this before?
Thanks for any insight.