+ Reply to Thread
Results 1 to 3 of 3

Selecting multiple row problem

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Selecting multiple row problem

    Hi, I am trying to select multiple rows so that i can sort. The code i have


    Set userrange1 = Workbooks(File_Name).Worksheets(Sht_name).Range("2:10").Select

    the above only works if "Sht_name" is the active sheet. If "Sht_name" is not the active sheet then the above code does not work. Any suggestions?
    Last edited by welchs101; 12-23-2008 at 08:58 AM.

  2. #2
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Still have problem but wanted something like this

    Hi,

    I thought i had fixed the problem with the following code but it does not work for some reason.

    Workbooks(File_Name).Worksheets(Sht_name).Range("2:10").Sort key1:=Range("G1"), order1:=xlAscending, Header:=xlYes

  3. #3
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    this works

    i guess i needed to also specify the full path after the "key1"

    Workbooks("working_file.xlsm").Worksheets("Sheet7").Range("2:20").Sort _
            key1:=Workbooks("working_file.xlsm").Worksheets("Sheet7").Range("G4"), order1:=xlAscending, Header:=xlNo


    this seems to work. My question now is can the "Range("G4")" entry be any value like G1, G2 or just G

+ Reply to Thread

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