+ Reply to Thread
Results 1 to 5 of 5

Instr function with named range

  1. #1
    Forum Contributor
    Join Date
    02-27-2020
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    425

    Instr function with named range

    Hi,

    I would like to write a macro in with an InStr function referring to a named range. The InStr function searches if a part of the string occurs in the named range and if true it places a certain string in the column next to it.

    I am not familiar with referring to namedranges in vba. I wrote this macro, but it doesn't work because i don't refer to the named range properly. I wrote this macro below. Any ideas how to do this?

    Any input is much appreciated!

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Instr function with named range

    You can't supply an array of values to Instr like that. You could use something like this:

    Please Login or Register  to view this content.
    Rory

  3. #3
    Forum Contributor
    Join Date
    02-27-2020
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    425

    Re: Instr function with named range

    Thanks Rorya, your answer is much appreciated!

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Instr function with named range

    Glad we could help.

  5. #5
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Instr function with named range

    Please try
    at E2
    =IFERROR(LOOKUP(2,1/MMULT(TRANSPOSE(ROW(Tabel1)),ISNUMBER(SEARCH(Tabel1,C2))*(Tabel1>0)),{"ZW/WAZO","WIA","WW","CRTV"}),"")

    Ctrl+Shift+Enter

    or
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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] If Function With Named Range (VBA)
    By NeedForExcel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-17-2015, 02:13 AM
  2. Is instr function re-entrant in VBA?
    By vientito in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-04-2013, 11:57 AM
  3. Replies: 1
    Last Post: 02-27-2013, 12:00 AM
  4. [SOLVED] InStr Function
    By msolari in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-18-2012, 01:52 PM
  5. Instr() function
    By Lifeseeker in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-20-2011, 03:57 PM
  6. Instr Function
    By max57 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-01-2010, 03:58 PM
  7. [SOLVED] InStr Function
    By zoot in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-04-2006, 10:55 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