Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping Macro with input boxes all related to one number
I have this macro designed (keep in mind I don't really understand it all),
it works really well but would like to make it so that I don't have to retype the account number all the time. The number is referenced to 3 different cells one ending with an "a" one with an "n" and one with a "g". So I have to have the account = input box for each cell referenced. Here is what I have done. TIA. Sub Enter_Runners() ' ' Enter_Runners Macro ' Macro recorded 10/17/2005 by Jeremy Barth ' ' Keyboard Shortcut: Ctrl+e Const TXTTITLE As String = "Turkey Trot Participants" Const NUMBERMSG As String = "Please enter Runner's Number" Const NAMEMSG As String = "Please enter Runner's Name" Const AGEMSG As String = "Please enter Runner's Age" Const GENDERMSG As String = "Please enter (1) for Male or (2) for Female" Dim ACCOUNT As Variant Dim NUMBER As Variant Do ACCOUNT = InputBox(NUMBERMSG, TXTTITLE) If ACCOUNT = "" Then Exit Sub ACCOUNT = "_" & ACCOUNT & "n" If ACCOUNT = "_." Then Application.Goto Reference:="MENU" Exit Sub Else With Range(ACCOUNT) Application.Goto Reference:=.Cells NUMBER = InputBox(NAMEMSG, TXTTITLE) If NUMBER = "" Then Exit Sub If .HasFormula Then .Formula = NUMBER Else .Formula = NUMBER End If End With End If ACCOUNT = InputBox(NUMBERMSG, TXTTITLE) If ACCOUNT = "" Then Exit Sub ACCOUNT = "_" & ACCOUNT & "a" If ACCOUNT = "_." Then Application.Goto Reference:="MENU" Exit Sub Else With Range(ACCOUNT) Application.Goto Reference:=.Cells NUMBER = InputBox(AGEMSG, TXTTITLE) If NUMBER = "" Then Exit Sub If .HasFormula Then .Formula = NUMBER Else .Formula = NUMBER End If End With End If ACCOUNT = InputBox(NUMBERMSG, TXTTITLE) If ACCOUNT = "" Then Exit Sub ACCOUNT = "_" & ACCOUNT & "g" If ACCOUNT = "_." Then Application.Goto Reference:="MENU" Exit Sub Else With Range(ACCOUNT) Application.Goto Reference:=.Cells NUMBER = InputBox(GENDERMSG, TXTTITLE) If NUMBER = "" Then Exit Sub If .HasFormula Then .Formula = NUMBER Else .Formula = NUMBER End If End With End If Loop End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I add input data in the input ranges in drop down boxes. | Excel Discussion (Misc queries) | |||
Looping Macro for fixed number of rows | Excel Programming | |||
Want to input one character to cause related string to display in. | Excel Worksheet Functions | |||
Looping through text boxes | Excel Programming | |||
Looping through text boxes | Excel Programming |