+ Reply to Thread
Results 1 to 4 of 4

Comparing two cells and running a macro as the result

  1. #1
    Registered User
    Join Date
    06-23-2011
    Location
    Springfield, MO
    MS-Off Ver
    Excel 2007
    Posts
    2

    Comparing two cells and running a macro as the result

    This is a great forum and I learned a lot by searching past threads, but I'm stuck on a macro that should be simple. I want to compare the value of the selected cell with the value of the cell immediately to the left. If the selected cell is less than the cell to the left, I want to automatically run another maco as a subroutine. Otherwise, do nothing. Thanks for the help
    Last edited by jbar; 06-23-2011 at 11:02 AM. Reason: Title change requested by moderator

  2. #2
    Registered User
    Join Date
    06-23-2011
    Location
    Springfield, MO
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: I'm new to macros and need some help

    As I look at what I posted, I realize that I didn't state it correctly. Obviously there is little value of comparing only two cells. It is really the B column comparing to the adjacent cell in the A column. Range is about 52,000

  3. #3
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: I'm new to macros and need some help

    In excel, right click on the sheet tab where you want to do this and click 'view code'

    Then in the drop down boxes at the top of the screen, select 'Worksheet' & 'SelectionChange'


    You'll see this appear:

    Please Login or Register  to view this content.
    In here goes your macro. What you'll be doing is running this macro whenever a user clicks into a cell in a range of cells you specify.

    Please Login or Register  to view this content.
    Last edited by swoop99; 06-23-2011 at 10:27 AM.

  4. #4
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: I'm new to macros and need some help

    Further:

    If you want to do this automatically for 52,000 rows then....

    Please Login or Register  to view this content.
    put this macro in a normal module and run with a button or something, rather than using the SelectionChange event.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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