Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA loops and subs
Trying to clean up some code for entering Daily sales figures from a userform
to another sheet. As the below code sits, it works fine and does everything I want except after several "months" of code VBA says it is to large to compile (Didn't know there was a limit to size). Tried to clean up the Daily checks with a DO_WHILE and FOR_NEXT loops but reference errors put my brain in an error loop. Any hints or suggestions would be greatly appreciated. Example: Private Sub cmdEnter_Click() Sheet2.Select Dim Msg, Style, Title 'Set up Message Box Msg = "Sales Already Entered for this Day. Select Another Day" ' Define message. Style = vbOKOnly ' Define buttons. Title = "Entry Error" ' Define MsgBox Title. Dim curLiq, curDraft As Currency, curBottle As Currency, curCan As Currency, curWine As Currency, curSoda As Currency curLiq = tbLiq 'Set inputs to currency for this section curDraft = tbDraft curBottle = tbBottle curCan = tbCan curWine = tbWine curSoda = tbSoda 'Start Month Checks If combMonth = "January" Then ' Check Month Selection ' Start Day Checks If combDay = "1st" Then If [c54].Value 0 Then 'Check if Sales already Entered GoSub MyResp 'If entered tell to select different day Else Range("c54").Activate ' If blank Enter Sales for day GoSub MySalesUpdate End If ElseIf combDay = "2nd" Then If [c55].Value 0 Then 'Check if Data already Entered GoSub MyResp Else Range("c55").Activate GoSub MySalesUpdate End If ElseIf combDay = "3rd" Then If [c56].Value 0 Then 'Check if Data already Entered GoSub MyResp Else Range("c56").Activate GoSub MySalesUpdate End If ElseIf combDay = "4th" Then If [c57].Value 0 Then 'Check if Data already Entered GoSub MyResp Else Range("c57").Activate GoSub MySalesUpdate End If ElseIf combDay = "5th" Then If [c58].Value 0 Then 'Check if Data already Entered GoSub MyResp Else Range("c58").Activate GoSub MySalesUpdate End If 'etc,etc,etc for the rest of the year |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Combining two Subs | Excel Discussion (Misc queries) | |||
Scope of Subs? | Excel Programming | |||
ending subs | Excel Programming | |||
Private subs | Excel Programming | |||
Stringing Subs | Excel Programming |