+ Reply to Thread
Results 1 to 3 of 3

Struggle with select case, index and match code in a UDF.

  1. #1
    Registered User
    Join Date
    01-11-2020
    Location
    Norway
    MS-Off Ver
    Microsoft Office 2019
    Posts
    74

    Struggle with select case, index and match code in a UDF.

    Hi,

    So I made a user defined function which is suppose to help me look up some values in a table. The thing is, the function has three options, so I start out with "select case".

    The code is as follows (the sheet names and ranges are simplified to not confuse people).

    Please Login or Register  to view this content.

    I just get "Value" in the cell where I place the code. I have no idea what can be wrong.

    Any help is highly appreciated!
    Last edited by -Citizen; 11-20-2021 at 08:07 AM.

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Struggle with select case, index and match code in a UDF.

    You don't need the Range("") around Value1 for sure and you probably don't need it around Name1 either (unless Name1 is a reference to a range like "S6"). So I would *guess* something like this where I took out the repeated use of Worksheets("Sheet1"):

    Please Login or Register  to view this content.
    WBD
    Office 365 on Windows 11, looking for rep!

  3. #3
    Registered User
    Join Date
    01-11-2020
    Location
    Norway
    MS-Off Ver
    Microsoft Office 2019
    Posts
    74

    Re: Struggle with select case, index and match code in a UDF.

    Quote Originally Posted by WideBoyDixon View Post
    You don't need the Range("") around Value1 for sure and you probably don't need it around Name1 either (unless Name1 is a reference to a range like "S6"). So I would *guess* something like this where I took out the repeated use of Worksheets("Sheet1"):

    Please Login or Register  to view this content.
    WBD
    Thank you my friend! That worked as a charm!

+ 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. Is it possible to use select case with index and match function?
    By -Citizen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-26-2021, 04:01 PM
  2. [SOLVED] Wildcards in Select Case Is code?
    By Jenn68 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-09-2019, 05:19 PM
  3. VBA match 4 conditional values at once with Select Case.
    By digibay in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-23-2015, 12:14 PM
  4. having trouble with select case code
    By JRJLHJ1823 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-23-2015, 09:38 PM
  5. [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
  6. Slow Case Select code
    By Kranky in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-06-2013, 05:57 PM
  7. [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

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