Macro Error

  • Thread starter Thread starter saltnsnails
  • Start date Start date
S

saltnsnails

I need help on a Macro..see below...the problem is at the end getting the
macro to go to the next wks. Can anyone help me out?

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 8/21/2008 by Kim Gable
'

'
Range("K7:K16").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertInformation, _
Operator:=xlBetween, Formula1:="TRUE"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = "Activity Does Not Match List"
.InputMessage = ""
.ErrorMessage = _
"This activity does not match the pre-approved activity list.
Please verify that the data was entered correctly or that the description
meets prevocational definition standards."
.ShowInput = True
.ShowError = True
Next wks
End Sub
 
You are missing the "For" statement that matches the "Next" statment (see
Help for
"For...Next Statement")

Jerry
 
Forgive me for being ignorant. Where is this help you are referring to? I
am just a beginning macro user :(
 
try this (I have inserted END WITH)
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 8/21/2008 by Kim Gable
'

'
Range("K7:K16").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertInformation, _
Operator:=xlBetween, Formula1:="TRUE"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = "Activity Does Not Match List"
.InputMessage = ""
.ErrorMessage = _
"This activity does not match the pre-approved activity list.
Please verify that the data was entered correctly or that the description
meets prevocational definition standards."
.ShowInput = True
.ShowError = True
End With
Next wks
End Sub
 
In the Visual Basic Editor, use the Help menu item and serch for the topic
"For...Next Statement"

Jerry
 
it looks as if you're running a loop with the "Next" command, but there's no
beginning to the loop (example: FOR wks= 1 TO 10). If your goal is to take
action on a worksheet and wish to move to another, you can try using the
command "Sheets(sheetname).Select". "sheetname" would be the actual name of
the sheet you wish to have the commands work on. You can duplicate all of
the commands over and over (which would be tiresome if you have a lot of
sheets), or you can create a loop and use the loop variable and the command
CHOOSE(variable,sheetname1,sheetname2,. . .). I'd recommend copying your
workbook and testing it before going "live".
 
Back
Top