+ Reply to Thread
Results 1 to 3 of 3

How to Set Sort Range based on Variables ??

  1. #1
    Registered User
    Join Date
    03-03-2011
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    53

    How to Set Sort Range based on Variables ??

    I am relatively new to VBA and strugling with Range selection so would appreciate any help forthcoming.

    I am running a macro which sorts a large worksheet row groups which will vary in length.

    The variable "r" is the first row of the group and the variable "famcount" is the number of rows in the group.

    I want to sort again within this group on columns G and Q using the variables before moving on to the next group, you can see what I have below. The Range Selection line works but the Selection.Sort does not.


    Please Login or Register  to view this content.
    All help much appreciated.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Set Sort Range based on Variables ??

    Try this. You don't need the Select and your error was caused by Range and Cells - you need one or the other, not both:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-03-2011
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: How to Set Sort Range based on Variables ??

    Quote Originally Posted by StephenR View Post
    Try this. You don't need the Select and your error was caused by Range and Cells - you need one or the other, not both:
    Please Login or Register  to view this content.
    Thanks, so much syntax, so little time

+ 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