Results 1 to 4 of 4

Dynamic Cell referencing in range function for vba in excel

Threaded View

  1. #1
    Registered User
    Join Date
    12-20-2010
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2003
    Posts
    6

    Dynamic Cell referencing in range function for vba in excel

    Hi All,
    I am just presenting the vba code below for sorting all columns (A4:T379) based on a value in a single column (M)
    Selection.AutoFilter Field:=rownumber, Criteria1:="<01-Feb-2011", Operator:=xlAnd
        Range("A4:T379").Sort Key1:=Range(M3), Order1:=xlAscending, Header:= _
            xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
            DataOption1:=xlSortNormal
    The above code sorts the range from A4 to T379 which is nothing but the data below the column headings which has autofilter in it.

    My question:
    Is it possible to substitute A4 and T379 with two variables which contains the address of the first cell and the last cell in the range. If so, Can anyone provide me with a syntax to substitute variables for A4 and T379 in the range function.

    Adv. Thanks for the help.
    KK
    Last edited by romperstomper; 12-22-2010 at 09:35 AM. Reason: tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1