Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i'm having difficulty getting the code below to do what i want. the intent
is to enter the month once and have the program retain that value as it cycles through the numbered worksheets and performs the appropriate subroutine. i've tried a couple of approaches but either it doesn't retain the value on subsequent worksheets or i can't get past the For Each..Next - it doesn't recognize the For Each portion when it gets to the end. Any thoughts would be appreciated. Thanks, Alan ____ Sub Prepare_All_Worksheets2() If MsgBox("Are you sure you want to move current forecast data to the prior section?" & vbCrLf & "(All Numbered Worksheets!)", vbQuestion + vbYesNo, "Move Forecast Data") = vbYes Then Dim prepMonth As String prepMonth = InputBox("What is the month you are preparing for?") Dim ws As Worksheet For Each ws In ActiveWorkbook.Worksheets ws.Select If IsNumeric(ActiveSheet.Name) Then If prepMonth = "November" Then Prepare_Nov Else If prepMonth = "December" Then Prepare_Dec Else If prepMonth = "January" Then Prepare_Jan Else If prepMonth = "February" Then Prepare_Feb Else If prepMonth = "March" Then Prepare_Mar Else If prepMonth = "April" Then Prepare_Apr Else If prepMonth = "May" Then Prepare_May Else If prepMonth = "June" Then Prepare_Jun Else If prepMonth = "July" Then Prepare_Jul Else If prepMonth = "August" Then Prepare_Aug Else If prepMonth = "September" Then Prepare_Sep Else MsgBox "There was a problem loading the data." End If End If End If End If End If End If End If End If End If End If End If Next ws Else 'USER CANCELLED MsgBox "Forecast data has NOT been moved.", vbCritical + vbOKOnly, "Move Forecast Data" End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Colon at the end of excel file name(ex: problem.xls:1, problem.xls | New Users to Excel | |||
Started out as an Access problem. Now an Excel problem | Excel Discussion (Misc queries) | |||
problem with a conditional max problem | Excel Discussion (Misc queries) | |||
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? | Excel Programming |