PDA

View Full Version : Solved: Variables in message box



JZB
08-21-2009, 12:54 AM
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 :banghead: .

Thanks

Jon

Bob Phillips
08-21-2009, 01:12 AM
myVar = InputBox("name of individual?")

GTO
08-21-2009, 01:15 AM
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:

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


Does that help?

Mark

JZB
08-21-2009, 02:20 AM
just about to apply - will let you know

appreciate the help guys

JZB
08-21-2009, 03:03 AM
perfect. works a treat

thanks a lot