+ Reply to Thread
Results 1 to 4 of 4

Help with VB Code to look in Column and compare it to a set Value

  1. #1
    Forum Contributor
    Join Date
    06-17-2014
    Location
    london
    MS-Off Ver
    365
    Posts
    398

    Help with VB Code to look in Column and compare it to a set Value

    Dear All

    I was wondering whther someone can help me with the follwoing code:

    I have a worksheet with three columns , Customer, Spend Division

    I need to look in the whole of column Division (c and compare it to my set variable which I have set in the code and if its equal to that the store it in another variable.

    My code so far is
    Please Login or Register  to view this content.
    However this doesn't work.

    Basically I want to look at the whole of Column C and if any of the cells is equal to Mens then returns the value of the corresponding cell in Col A:.

    Any hep is appreciate it

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Help with VB Code to look in Column and compare it to a set Value

    Try this
    All variables need the "As String" (or whatever), otherwise only the last one is declared as type "String"
    The range you should have declared was "divs" (not "Range")
    The code builds up a message string to give you everything listed at the end
    If you want an explanation of anything please ask.

    Please Login or Register  to view this content.
    Kev

  3. #3
    Forum Contributor
    Join Date
    06-17-2014
    Location
    london
    MS-Off Ver
    365
    Posts
    398

    Re: Help with VB Code to look in Column and compare it to a set Value

    Thanks Kev

    This worked great

  4. #4
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Help with VB Code to look in Column and compare it to a set Value

    You are welcome.

+ 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] VBA code to compare rows based on 4 column values and highlight is no match
    By Sirilias in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-16-2015, 02:22 PM
  2. [SOLVED] need vba code to compare two column get result of common values of both column
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-12-2013, 05:42 AM
  3. [SOLVED] Compare two names list and compare other column aftrerwards
    By badboynads in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-25-2013, 12:46 PM
  4. [SOLVED] Need micro compare code in sheet2 and sheet3 with code in sheet1
    By jamalmail in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-21-2013, 05:15 PM
  5. VBA code for Compare two column and find the unmatch item in another column
    By SAI2050 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-04-2013, 03:11 AM
  6. how to compare column values with a code
    By Zimmerman in forum Excel General
    Replies: 6
    Last Post: 07-02-2010, 07:49 AM
  7. [SOLVED] Need code to compare cell values in a column
    By Chirs in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-10-2005, 06:37 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