Hi all,
I'm having problems with a simple piece of code which suddenly stopped working, and I don't recall changing anything which has caused this to break. The code says 'object variable or with block variable not set', but I have set the dim above. Here is my code:
Dim ThisWorkBook As Workbook
Dim Cell2 As Range
For Each Cell2 In ThisWorkBook.Worksheets("Data").Range("Z91:Z186") 'Debug highlights this line
'Long piece of additional code
Next Cell2
Thanks in advance
I'm having problems with a simple piece of code which suddenly stopped working, and I don't recall changing anything which has caused this to break. The code says 'object variable or with block variable not set', but I have set the dim above. Here is my code:
Dim ThisWorkBook As Workbook
Dim Cell2 As Range
For Each Cell2 In ThisWorkBook.Worksheets("Data").Range("Z91:Z186") 'Debug highlights this line
'Long piece of additional code
Next Cell2
Thanks in advance