+ Reply to Thread
Results 1 to 4 of 4

Call Issue

  1. #1
    ToferKing
    Guest

    Call Issue

    I have a workbook that has ComboBoxes, InputBoxes and CommandButtons in the
    top 20 rows.

    I need to be able to control those items so that if a user happens to have
    his cursor placed on rows 1 through 20, the buttons and boxes will give him
    an error message saying he needs to be in the lower part of the workbook.

    I have adjusted one of the click subs as follows:

    If ActiveCell.Row < 21 Then TooHighUp Else
    myCell = "A" & ActiveCell.Row
    Range(myCell).Offset(0, 0).Range("A1:AJ1").Select
    Selection.Interior.ColorIndex = xlNone
    ActiveCell.Select


    The routine TooHighUp is shown below:

    Private Sub TooHighUp()
    MsgBox ("You need to be in the lower part of the workbook.")
    End Sub

    Part of the coding is working correctly. If the user is below row 20, the
    macro runs as it should, if the user is above row 20 the macro displays the
    Message Box, but then the sub TooHighUp returns control to my click event and
    that program runs.

    How do I tell the macro to run the Sub TooHighUp and then stop?

    Thanks for your help, once again.

    Tofer

  2. #2
    ToferKing
    Guest

    RE: Call Issue


    I placed the word End on the line below this one and my problem is fixed.

    MsgBox ("You need to be in the lower part of the workbook.")

    Thanks, guys.

    "ToferKing" wrote:

    > I have a workbook that has ComboBoxes, InputBoxes and CommandButtons in the
    > top 20 rows.
    >
    > I need to be able to control those items so that if a user happens to have
    > his cursor placed on rows 1 through 20, the buttons and boxes will give him
    > an error message saying he needs to be in the lower part of the workbook.
    >
    > I have adjusted one of the click subs as follows:
    >
    > If ActiveCell.Row < 21 Then TooHighUp Else
    > myCell = "A" & ActiveCell.Row
    > Range(myCell).Offset(0, 0).Range("A1:AJ1").Select
    > Selection.Interior.ColorIndex = xlNone
    > ActiveCell.Select
    >
    >
    > The routine TooHighUp is shown below:
    >
    > Private Sub TooHighUp()
    > MsgBox ("You need to be in the lower part of the workbook.")
    > End Sub
    >
    > Part of the coding is working correctly. If the user is below row 20, the
    > macro runs as it should, if the user is above row 20 the macro displays the
    > Message Box, but then the sub TooHighUp returns control to my click event and
    > that program runs.
    >
    > How do I tell the macro to run the Sub TooHighUp and then stop?
    >
    > Thanks for your help, once again.
    >
    > Tofer


  3. #3
    Jim Cone
    Guest

    Re: Call Issue

    Change the first two lines to these four lines...

    If ActiveCell.Row < 21 Then
    TooHighUp
    Exit Sub
    End If
    --------
    Jim Cone
    San Francisco, USA
    http://www.realezsites.com/bus/primitivesoftware



    "ToferKing"
    <ToferKing@discussions.microsoft.com>
    wrote in message
    I have a workbook that has ComboBoxes, InputBoxes and CommandButtons
    in the top 20 rows.
    I need to be able to control those items so that if a user happens to have
    his cursor placed on rows 1 through 20, the buttons and boxes will give him
    an error message saying he needs to be in the lower part of the workbook.

    I have adjusted one of the click subs as follows:
    If ActiveCell.Row < 21 Then TooHighUp Else
    myCell = "A" & ActiveCell.Row
    Range(myCell).Offset(0, 0).Range("A1:AJ1").Select
    Selection.Interior.ColorIndex = xlNone
    ActiveCell.Select


    The routine TooHighUp is shown below:
    Private Sub TooHighUp()
    MsgBox ("You need to be in the lower part of the workbook.")
    End Sub

    Part of the coding is working correctly. If the user is below row 20, the
    macro runs as it should, if the user is above row 20 the macro displays the
    Message Box, but then the sub TooHighUp returns control to my click event and
    that program runs.
    How do I tell the macro to run the Sub TooHighUp and then stop?
    Thanks for your help, once again.
    Tofer

  4. #4
    ToferKing
    Guest

    Re: Call Issue

    Hey, Jim,

    That works too.

    Thanks - Tofer

    "Jim Cone" wrote:

    > Change the first two lines to these four lines...
    >
    > If ActiveCell.Row < 21 Then
    > TooHighUp
    > Exit Sub
    > End If
    > --------
    > Jim Cone
    > San Francisco, USA
    > http://www.realezsites.com/bus/primitivesoftware
    >
    >
    >
    > "ToferKing"
    > <ToferKing@discussions.microsoft.com>
    > wrote in message
    > I have a workbook that has ComboBoxes, InputBoxes and CommandButtons
    > in the top 20 rows.
    > I need to be able to control those items so that if a user happens to have
    > his cursor placed on rows 1 through 20, the buttons and boxes will give him
    > an error message saying he needs to be in the lower part of the workbook.
    >
    > I have adjusted one of the click subs as follows:
    > If ActiveCell.Row < 21 Then TooHighUp Else
    > myCell = "A" & ActiveCell.Row
    > Range(myCell).Offset(0, 0).Range("A1:AJ1").Select
    > Selection.Interior.ColorIndex = xlNone
    > ActiveCell.Select
    >
    >
    > The routine TooHighUp is shown below:
    > Private Sub TooHighUp()
    > MsgBox ("You need to be in the lower part of the workbook.")
    > End Sub
    >
    > Part of the coding is working correctly. If the user is below row 20, the
    > macro runs as it should, if the user is above row 20 the macro displays the
    > Message Box, but then the sub TooHighUp returns control to my click event and
    > that program runs.
    > How do I tell the macro to run the Sub TooHighUp and then stop?
    > Thanks for your help, once again.
    > Tofer
    >


+ 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