OilEconomist
Active Member
- Joined
- Dec 26, 2016
- Messages
- 439
- Office Version
- 2019
- Platform
- Windows
Thanks in advance for your assistance. I have just excerpted the part of the code that causes issues. Why am I getting a "Run Time error '1004': Application-defined or object-defined error" for this line of code:
in the following code:
When I replace that line with the following, it works:
VBA Code:
Set LoopRng = Range(Cells(8, ColNoStart), Cells(8, CoNoEnd))
in the following code:
Excel Formula:
Sub RngError()
Dim ColNoStart As Long
Dim ColNoEnd As Long
Dim LoopRng As Range
ColNoStart = 1
ColNoEnd = 12
Set LoopRng = Range(Cells(8, ColNoStart), Cells(8, CoNoEnd))
End Sub
When I replace that line with the following, it works:
Excel Formula:
Set LoopRng = Range("B8:L8")