xluser2007
12-02-2008, 06:10 PM
Hi All,
I am doing the following:
Option Explicit
Sub test()
ThisWorkbook.Worksheets("Expected").Range("T1").Resize(1, -16).calculate
End Sub
That is, select the relevant region with respect to T1 and calculate it.
However, I will be requiring to calculate this many times in a loop and wanted to SET this calculation range in the macro as follows:
Option Explicit
Sub test()
Dim rng As Range
Set rng = ThisWorkbook.Worksheets("Expected").Range("T1").Resize(1, -16)
' Then do more steps here and then recalculate range
rng.Calculate
End Sub
The red throws an '1004' error Application defined or object defined error.
Ani ideas on how to correct for this as optimally as possible (i.e. without selecting the rng)?
Any help appreciated.
I am doing the following:
Option Explicit
Sub test()
ThisWorkbook.Worksheets("Expected").Range("T1").Resize(1, -16).calculate
End Sub
That is, select the relevant region with respect to T1 and calculate it.
However, I will be requiring to calculate this many times in a loop and wanted to SET this calculation range in the macro as follows:
Option Explicit
Sub test()
Dim rng As Range
Set rng = ThisWorkbook.Worksheets("Expected").Range("T1").Resize(1, -16)
' Then do more steps here and then recalculate range
rng.Calculate
End Sub
The red throws an '1004' error Application defined or object defined error.
Ani ideas on how to correct for this as optimally as possible (i.e. without selecting the rng)?
Any help appreciated.