Results 1 to 3 of 3

Thread: Solved: Help with resize

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Expert
    Joined
    Dec 2007
    Posts
    520
    Location

    Solved: Help with resize

    Hi All,

    I am doing the following:
    [vba]
    Option Explicit

    Sub test()

    ThisWorkbook.Worksheets("Expected").Range("T1").Resize(1, -16).calculate

    End Sub[/vba]
    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:

    [vba]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[/vba]
    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.
    Last edited by xluser2007; 12-02-2008 at 07:12 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •