+ Reply to Thread
Results 1 to 12 of 12

promt warning msg if value in cel "" is below value in cell ""

Hybrid View

shilpz promt warning msg if value in... 03-05-2008, 12:41 PM
MickG Hi, something like:- Dim... 03-06-2008, 09:42 AM
shilpz as i mentioned in the... 03-15-2008, 06:29 AM
VBA Noob Can you confirm what you... 03-15-2008, 07:22 AM
MickG Hi I'm not totally clear this... 03-15-2008, 07:28 AM
royUK Why use code when Data... 03-15-2008, 08:01 AM
  1. #1
    Registered User
    Join Date
    01-14-2008
    Posts
    76

    promt warning msg if value in cell "" is below value in cell ""

    hello

    i wanted to know if there is a way which i can so that would tell excel if a certain cell value is lower then another it would give a msg
    for example

    Cell A1 - 5
    so if cell A2 is less then five and a macro is clicked then the macro would give a warning msg hence ending the macro

    thanks in advance
    Last edited by shilpz; 03-05-2008 at 12:54 PM.

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650
    Hi, something like:-
    Dim oNum As Integer
     For oNum = 1 To 5
         If Cells(oNum, "A").Value < 5 Then
             MsgBox "Range " & Cells(oNum, "A").Address & " Value is < 5"
        End If
    Next oNum
    Regards Mick

  3. #3
    Registered User
    Join Date
    01-14-2008
    Posts
    76
    as i mentioned in the previous post that if

    Cell A1 - 5
    so if cell A2 is less then five and a macro is clicked then the macro would give a warning msg hence ending the macro

    i meant the other way round sorry so if

    Cell A1 is 5 then
    if A2 value is more then 5 then a warning message will comeup and when the macro is clicked it will give a warning message sayin "macro cannot continue"
    but keeping in mind that Cell A1 can change anytime therefore it is not a specific range

    sorry for the annoyance
    thanks in advance

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    mind that Cell A1 can change anytime therefore it is not a specific range

    Can you confirm what you mean. Is it A1 the activecell or what

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  5. #5
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650
    Hi I'm not totally clear this what you want, but this code will present a msgbox, and exit the Macro, if any value between "A2" to "A5" is greater than the value in "A1". I assume you meant the value in "A1" could change not the location Address.
    Dim oNum As Integer
     For oNum = 2 To 5
         If Cells(oNum, "A").Value > Range("A1").Value Then
             MsgBox "Range " & Cells(oNum, "A").Address & _
             " Value is > " & Range("A1").Value & vbNewLine & _
             "     ""Macro Ended"""
             End If
    Next oNum
    Regards Mick

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Why use code when Data Validation can do this?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  7. #7
    Registered User
    Join Date
    01-14-2008
    Posts
    76

    help on the problem

    hello

    i am sorry i dident really explain my problem properly before i have created a example spreadsheet of what the prodblem is can you please help me solve it

    thanks in advance
    Attached Files Attached Files

+ 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