Results 1 to 7 of 7

Set range and offset

Threaded View

  1. #1
    Registered User
    Join Date
    04-12-2007
    Posts
    57

    Set range and offset

    I am having trouble with one line of this code that I can't figure out how to write correctly. I have set the range, but I need to offset by 10 rows up. My code fails at set rng. Here is what I have so far
    Dim LsTRow As Long
    Dim rng As range
    LsTRow = Cells(Rows.Count, "A").End(xlUp).Row
    Set rng = range("A7:q" & LsTRow).Offset(-10, 0).Select
    
    With rng
        .Sort Key1:=.Cells(7, 3), Order1:=xlAscending, _
        Key2:=.Cells(7, 1), Order3:=xlAscending, Header _
        :=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom _
        , DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
        xlSortNormal
    End With
    End Sub
    Last edited by sammar12; 05-16-2009 at 06:10 PM.

Thread Information

Users Browsing this Thread

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

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