Hi,
I have isolated a piece of code which has been working 3 years which stopped working.
I have found a work around but I would like to know why the original code wouldn't work
This code no longer works
It gives
This code works and has the desired effect.
even this works
I use "MS....." throughout the module, probably 30+ instances and all other lines of code still function correctly.
Thanks for helping
I have isolated a piece of code which has been working 3 years which stopped working.
I have found a work around but I would like to know why the original code wouldn't work
This code no longer works
It gives
Runtime Error '9'
Subscript out of range
VBA Code:
Sub test()
Dim MS As Worksheet
Set MS = Sheets("Chasing")
With MS
.Range("H5", .Range("K5000")).ClearContents
End With
End Sub
This code works and has the desired effect.
VBA Code:
Sub test()
With Sheets("Chasing")
.Range("H5", .Range("K5000")).ClearContents
End With
End Sub
even this works
VBA Code:
Sub test()
Dim MS As Worksheet
Set MS = Sheets("Chasing")
With MS
Sheets("Chasing").Range("H5", .Range("K5000")).ClearContents
End With
End Sub
I use "MS....." throughout the module, probably 30+ instances and all other lines of code still function correctly.
Thanks for helping