+ Reply to Thread
Results 1 to 4 of 4

VBA - If ActiveCell.Value (from sheet 1) exists in a range in sheet 2

  1. #1
    Registered User
    Join Date
    04-12-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    1

    Question VBA - If ActiveCell.Value (from sheet 1) exists in a range in sheet 2

    Hi, I tried googling this and also did a search on this forum, didnt really find what i was looking for.
    Just need help on checking if a given value (im using ActiveCell.value) exists in a range from another sheet.

    what i mean is:
    If ActiveCell.Value from sheet 1 exists in [Range Name] in sheet 2 then
    bla bla bla
    End If

    I know its a simple idea and thats why it frustrates me even more as to why i cant figure it out lol...

    If needed, sheet 1's name is 'Assets', sheet 2's name is 'Lists', and Range name is 'Equipment'

    Ive been stuck on this for a while so Please help ASAP! Huge Thanks in advance!

  2. #2
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: VBA - If ActiveCell.Value (from sheet 1) exists in a range in sheet 2

    Hi
    Pls upload a sample file
    Click *, if my suggestion helps you. Have a good day!!

  3. #3
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: VBA - If ActiveCell.Value (from sheet 1) exists in a range in sheet 2

    Something like this? (as Post #2 indicated, it's tough without a sample wb)...

    Disclaimer: This code assumes the range to be searched is a global named range. If it is a dynamic range (on Sheet 2), the rngLook variable will need to be modified.
    Please Login or Register  to view this content.
    Alternatively, you could possibly find a solution through a 'find' approach. Disclaimer: untested

    Please Login or Register  to view this content.
    Last edited by AlvaroSiza; 04-12-2012 at 02:26 AM.
    Perhaps it was the Noid who should have avoided me...
    If you are satisfied with my solution click the small star icon on the left. Thanks
    1. Make a copy of your workbook and run the following code on your copy (just in case)
    2. With excel open, press ALT+F11 to open the Visual Basic Editor (VBE). From the "Insert" menu, select "Module".
    3. Paste the code from above into the empty white space. Close the VBE.
    4. From the developer tab, choose "Macros", select the Sub Name, and click "Run".

  4. #4
    Registered User
    Join Date
    02-05-2011
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: VBA - If ActiveCell.Value (from sheet 1) exists in a range in sheet 2

    Hi,

    Please allow me to bump this thread.

    I tried the upper solution given by AlvaroSiza but I get an error message: "Run-time error 424: object required" on line
    Please Login or Register  to view this content.
    All of my code:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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