Results 1 to 2 of 2

Issue with If Statement based greater than in macro

Threaded View

  1. #1
    Registered User
    Join Date
    02-07-2012
    Location
    Michigan
    MS-Off Ver
    Excel 2007
    Posts
    8

    Issue with If Statement based greater than in macro

    I am trying to run a macro that checks to see if an increment has increased above and threshold and then increment another value. I want to implement:
    Sub Month_Chg()
    Range("c2").Select
    If (Selection.Value > "12") Then
    Range("A2").Select
    Selection.Value = Selection.Value + 1
    End If
    But when I run the macro with a value less than 12 it still runs as if the statement was TRUE and completes the increment. The only way that I can get it to run is to go with:

    Sub Month_Chg()
    Range("c2").Select
    If (Selection.Value = "13") Then
    Range("A2").Select
    Selection.Value = Selection.Value + 1
    End If
    What I am doing wrong?

    Thanks,

    Dave
    Last edited by tiggerzen; 02-07-2012 at 12:15 PM. Reason: Comply with forum rules

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