Consulting

Results 1 to 5 of 5

Thread: Solved: Variables in message box

  1. #1
    VBAX Regular
    Joined
    Mar 2009
    Posts
    48
    Location

    Solved: Variables in message box

    Hi Guys

    I am producing a macro which will chart the performance of any individual the user chooses.

    How do i create a pop up box at the start of the macro where the user can specify the name of the individual they wish to see a chart of?

    Also how can i then make that answer my variable?

    The rest of the macro is quite simple. Just using find the variable and then chart the range of offset cells.

    Just stuck on this bit .

    Thanks

    Jon

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    myVar = InputBox("name of individual?")
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Greetings,

    If the names are in a range of rows or columns, you may wish to consider a userform with a listbox. This prevents mis-typing issues.

    If not, maybe InputBox:
    [vba]
    Option Explicit

    Sub exa()
    Dim strName As String

    strName = Application.InputBox(Prompt:="Type in the name of the person to ceck", _
    Title:=vbNullString, _
    Type:=2)
    If Not strName = vbNullString _
    And Not strName = "False" Then
    MsgBox "Other code to return " & strName
    End If

    End Sub
    [/vba]

    Does that help?

    Mark

  4. #4
    VBAX Regular
    Joined
    Mar 2009
    Posts
    48
    Location
    just about to apply - will let you know

    appreciate the help guys

  5. #5
    VBAX Regular
    Joined
    Mar 2009
    Posts
    48
    Location
    perfect. works a treat

    thanks a lot

Posting Permissions

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