+ Reply to Thread
Results 1 to 4 of 4

VBA Macro Not Working Anymore

Hybrid View

guhaka VBA Macro Not Working Anymore 09-04-2020, 02:23 AM
Greg M Re: VBA Macro Not Working... 09-04-2020, 04:47 AM
jindon Re: VBA Macro Not Working... 09-04-2020, 05:26 AM
guhaka Re: VBA Macro Not Working... 09-04-2020, 06:46 AM
  1. #1
    Registered User
    Join Date
    02-18-2020
    Location
    Netherlands
    MS-Off Ver
    Office 365 Pro Plus
    Posts
    20

    VBA Macro Not Working Anymore

    Hi All,

    I need an urgent help on this topic.

    I am using this code which I found in internet for looking up multiple instances lincked to a key and contatinate the same.

    This was working fine earlier in my excel. Now its giving #VALUE error.

    Please help!


    Function Lookup_concat(Search_string As String, _
    Search_in_col As Range, Return_val_col As Range)

    Dim i As Long
    Dim result As String

    For i = 1 To Search_in_col.Count
    If Search_in_col.Cells(i, 1) = Search_string Then
    result = result & "/" & Return_val_col.Cells(i, 1).Value
    End If
    Next

    Lookup_concat = Trim(result)

    End Function

    Regards
    Kaushik

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641

    Re: VBA Macro Not Working Anymore

    Hi there,

    Without seeing your workbook it is impossible to be certain what is causing the error in your particular case, but a value of #VALUE!, #DIV/0! or #NA in the range specified by the "Search_in_col" argument will cause it.

    Hope this helps.

    Regards,

    Greg M

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA Macro Not Working Anymore

    1)
    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    2) try change to
    If cstr(Search_in_col.Cells(i, 1)) = Search_string Then

  4. #4
    Registered User
    Join Date
    02-18-2020
    Location
    Netherlands
    MS-Off Ver
    Office 365 Pro Plus
    Posts
    20

    Re: VBA Macro Not Working Anymore

    The issue was solved. It was a simple overlook of the fact that the source data had some value error. Corrected it. And the code worked fine.
    Thanks for the response though.

+ 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. ALT + TAB not working correctly anymore
    By phillyd023 in forum Excel General
    Replies: 3
    Last Post: 01-07-2018, 11:22 PM
  2. F1 Help key not working anymore
    By Phil8 in forum Excel General
    Replies: 0
    Last Post: 09-16-2017, 10:13 AM
  3. VBA Macro not working anymore
    By winsomeness in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-09-2015, 08:20 PM
  4. [SOLVED] TRIM macro suddenly not working anymore - Runtime 13 Type Mismatch
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-07-2014, 03:30 PM
  5. [SOLVED] Conditional Formatting not working anymore - Macro enable workbook
    By Lukael in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 02-20-2014, 11:43 AM
  6. VBA code not working anymore
    By random379 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-24-2012, 03:01 AM
  7. Macro - Reset button not working anymore
    By heather1209 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-28-2011, 06:05 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