+ Reply to Thread
Results 1 to 4 of 4

What am I doing wrong....!!!

  1. #1
    Registered User
    Join Date
    05-20-2005
    Posts
    3

    What am I doing wrong....!!!

    Hello,

    Hope someone can help with this please...

    Using VB in Excel....

    A value is entered into a cell in Excel and plotted on my line chart...

    I need a message box to be shown when the value is less than 15,250 or above 15,310. I cannot get the msgbox to show up....The value is being entered in cell B1..I have tried to use B1 in the code as an alternative to TextBox1 but still doesn't work....

    My attempt at coding is as follows:

    Sub Add_Entry()
    Range("A7").End(xlDown).Offset(1, 0).Select
    ActiveCell.Value = TextBox1.Value
    TextBox1.Value = ""
    Range("B1").Select
    If TextBox1.Value > 15310 Then MsgBox "Outside Limits - Schedule Maintenance", vbCritical + vbOKOnly, "Urgent"

    End Sub


    hope someone can help,

    thanks in advance
    simon..

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Simon,

    You can correct this problem this way...

    Correction #1 Move Clearing the TextBox:

    Sub Add_Entry()
    Range("A7").End(xlDown).Offset(1, 0).Select
    ActiveCell.Value = TextBox1.Value
    Range("B1").Select

    If TextBox1.Value > 15310 Then MsgBox "Outside Limits - Schedule Maintenance", vbCritical + vbOKOnly, "Urgent"
    TextBox1.Value=""
    End Sub


    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    05-20-2005
    Posts
    3

    you're a star

    Fantastic..many thanks for the prompt response..

    I had been staring at the code all day and now its working...

    Many thanks once again..

    Simon...

  4. #4
    Jim Thomlinson
    Guest

    RE: What am I doing wrong....!!!

    You can use data -> validation to do this. Look at data validation
    http://www.contextures.com/xlDataVal01.html

    --
    HTH...

    Jim Thomlinson


    "squoggy" wrote:

    >
    > Hello,
    >
    > Hope someone can help with this please...
    >
    > Using VB in Excel....
    >
    > A value is entered into a cell in Excel and plotted on my line
    > chart...
    >
    > I need a message box to be shown when the value is less than 15,250 or
    > above 15,310. I cannot get the msgbox to show up....The value is being
    > entered in cell B1..I have tried to use B1 in the code as an
    > alternative to TextBox1 but still doesn't work....
    >
    > My attempt at coding is as follows:
    >
    > Sub Add_Entry()
    > Range("A7").End(xlDown).Offset(1, 0).Select
    > ActiveCell.Value = TextBox1.Value
    > TextBox1.Value = ""
    > Range("B1").Select
    > If TextBox1.Value > 15310 Then MsgBox "Outside Limits - Schedule
    > Maintenance", vbCritical + vbOKOnly, "Urgent"
    >
    > End Sub
    >
    >
    > hope someone can help,
    >
    > thanks in advance
    > simon..
    >
    >
    > --
    > squoggy
    > ------------------------------------------------------------------------
    > squoggy's Profile: http://www.excelforum.com/member.php...o&userid=23561
    > View this thread: http://www.excelforum.com/showthread...hreadid=376005
    >
    >


+ 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