Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I add input data in the input ranges in drop down boxes. oil_driller Excel Discussion (Misc queries) 1 November 9th 05 10:31 PM
Looping Macro for fixed number of rows Robert Excel Programming 5 February 28th 05 04:41 PM
Want to input one character to cause related string to display in. Peace of Christ be with you Excel Worksheet Functions 6 February 20th 05 06:33 AM
Looping through text boxes skrimpy[_7_] Excel Programming 0 September 26th 04 07:56 PM
Looping through text boxes skrimpy[_3_] Excel Programming 1 September 25th 04 04:42 PM


All times are GMT +1. The time now is 07:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"