Consulting

Results 1 to 2 of 2

Thread: Need help with Excel Macro - InRange??

  1. #1
    VBAX Regular
    Joined
    Nov 2005
    Posts
    31
    Location

    Need help with Excel Macro - InRange??

    Hi there

    This is an Excel question. I'm not so sure if it can be done or not.

    I want the user to select a Cell in Column C before executing a macro. If any other cell is selected in any other column, except column C then I want a MsgBox saying "Please select an Account Number in Column C." When the user clicks on the OK button on the MsgBox, the macro exits. The user then selects and Account Number in Column C and then executes the macro.

    Thanks,

    Mario

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Try this:

    [vba]
    Option Explicit

    Sub Macro1()

    Dim Prompt As String
    Dim Title As String

    If Intersect(ActiveCell, Range("C:C")) Is Nothing Then
    Prompt = "Please select an Account Number in Column C."
    Title = "Procedure Canceled"
    MsgBox Prompt, vbCritical, Title
    GoTo ExitSub:
    End If

    'The Rest Of Your Macro Here

    ExitSub:

    End Sub
    [/vba]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •