+ Reply to Thread
Results 1 to 3 of 3

Issue with Case Select and Sort Key

  1. #1
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    779

    Issue with Case Select and Sort Key

    i have the below where I am searching for an Up/Down arrow character to find the last column sorted, and then to resort on that column (as part of a larger pivot change script).

    If I place the LastSortColumn Variable outside the case statement, the code will execute without error. But when trying with the case select, I get an Run Time 5; Invalid Procedure call or argument.

    In trying to trouble shoot, the message box "Found" pops up, so it finds the character just fine, but then the select doesn't work?

    Can anyone offer some ideas or thoughts where I am going wrong?

    and I have both variables c and LastSortColumn being defined as a Range at the top of script.

    Please Login or Register  to view this content.
    Last edited by ptmuldoon; 11-24-2020 at 07:03 PM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,229

    Re: Issue with Case Select and Sort Key

    Please Login or Register  to view this content.
    Are you testing if the value in c is the same as the value in O4
    or are you testing if c is same cell as O4?

    The way it is currently written above it is comparing cell values.

    This will test the c address
    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    779

    Re: Issue with Case Select and Sort Key

    Quote Originally Posted by AlphaFrog View Post

    This will test the c address
    Please Login or Register  to view this content.

    Thank you!!! Yes, that worked. Essentially just trying to find the column it was in.

    I've further decided to use a helper cell/row for the value also instead of having separate code to search for each character separately.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Issue with Select Case and for loop
    By starlev in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-29-2017, 10:36 AM
  2. [SOLVED] Select Case - if no match issue
    By D_N_L in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-12-2014, 11:57 AM
  3. [SOLVED] Select Case - End select issue
    By HerryMarkowitz in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-31-2013, 02:07 PM
  4. [SOLVED] Disregard case in VBA code. (UCase, LCase, Select Case)
    By Orestees in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 09-07-2012, 12:12 PM
  5. Case Select compile error "Case without case select"
    By coasterman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-23-2012, 06:50 AM
  6. Case Select....The alternative method for long "Select Case"
    By kimyap in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2008, 01:24 AM
  7. Select Case - issue
    By George in forum Excel General
    Replies: 7
    Last Post: 03-17-2006, 01:25 AM

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