Results 1 to 2 of 2

Run Macro if 2 cells are the same

Threaded View

stevetothink Run Macro if 2 cells are the... 04-16-2013, 03:18 PM
tehneXus Re: Run Macro if 2 cells are... 04-16-2013, 04:06 PM
  1. #1
    Registered User
    Join Date
    10-18-2010
    Location
    NJ
    MS-Off Ver
    Excel 2007
    Posts
    73

    Run Macro if 2 cells are the same

    I've built a large macro by recording it step by step. It is currently assigned to "ctrl a." I'd like to add one more piece to it before it runs through the full code. I've pasted the top portion of my macro below. After I press ctrl a I'd like it to check to make sure 2 cells match before it runs through the rest of the code. If they match then I want it to continue. Otherwise, I want it to display a message box if the 2 cells do not match.

    For example
    If sheets/Template 1 cell CF31 = sheets/Template 1 cell CF32 then run the macro named Import_File. Otherwise, display a box that says "Share totals do not match."

    Is this possible?


    Here is how my current macro starts.
    Sub Import_File()
    '
    ' Import_File Macro
    '
    ' Keyboard Shortcut: Ctrl+a
    '
        
        Sheets("Template 1").Select
        ActiveWindow.SmallScroll Down:=-15
        Range("A1").Select
        ActiveWorkbook.Save
        
        Sheets("Import File").Select
        Range("A1").Select
        
      '<Lots of code after this>
    Thanks,
    Steve
    Last edited by Leith Ross; 04-16-2013 at 03:37 PM. Reason: Added Code Tags

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