ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA script question (https://www.excelbanter.com/excel-programming/421509-vba-script-question.html)

howard

VBA script question
 
I need a short VBA script that will check a specific cell on a worksheet for
the day of the week (from a drop-down menu) and then run the required macro
(one for each day of the week). Any ideas
Thanks
--
Howard

FSt1

VBA script question
 
hi
this should get you going. i didn't put all the days in the macro but you
can add what days you require. also you may need to adjust the taget cell.

Sub selectthecase()
Dim r As Range
Set r = Range("A1")
If IsEmpty(r) Then 'in case cell is empty
MsgBox "need imput"
Exit Sub
End If

Select Case r
Case Is = "Monday"
Call mondaymacro
Case Is = "Tuesday"
Call Tuesdaymacro
Case Is = "wednesday"
Call Wednesdaymacro
Case Else
MsgBox "on your own here?"
End Select

End Sub

regards
FSt1

"Howard" wrote:

I need a short VBA script that will check a specific cell on a worksheet for
the day of the week (from a drop-down menu) and then run the required macro
(one for each day of the week). Any ideas
Thanks
--
Howard


howard

VBA script question
 
FSt1
Thanks for the quick reply. This should do nicely. I'll give it a try.

Howard
--
Howard


"FSt1" wrote:

hi
this should get you going. i didn't put all the days in the macro but you
can add what days you require. also you may need to adjust the taget cell.

Sub selectthecase()
Dim r As Range
Set r = Range("A1")
If IsEmpty(r) Then 'in case cell is empty
MsgBox "need imput"
Exit Sub
End If

Select Case r
Case Is = "Monday"
Call mondaymacro
Case Is = "Tuesday"
Call Tuesdaymacro
Case Is = "wednesday"
Call Wednesdaymacro
Case Else
MsgBox "on your own here?"
End Select

End Sub

regards
FSt1

"Howard" wrote:

I need a short VBA script that will check a specific cell on a worksheet for
the day of the week (from a drop-down menu) and then run the required macro
(one for each day of the week). Any ideas
Thanks
--
Howard


howard

VBA script question
 
I tried this and it isn't working. If I manually run the sub, it works, but
I need it to run any time that the text in the "r" cell is changed. Any
ideas?
Thanks for all the help
--
Howard


"FSt1" wrote:

hi
this should get you going. i didn't put all the days in the macro but you
can add what days you require. also you may need to adjust the taget cell.

Sub selectthecase()
Dim r As Range
Set r = Range("A1")
If IsEmpty(r) Then 'in case cell is empty
MsgBox "need imput"
Exit Sub
End If

Select Case r
Case Is = "Monday"
Call mondaymacro
Case Is = "Tuesday"
Call Tuesdaymacro
Case Is = "wednesday"
Call Wednesdaymacro
Case Else
MsgBox "on your own here?"
End Select

End Sub

regards
FSt1

"Howard" wrote:

I need a short VBA script that will check a specific cell on a worksheet for
the day of the week (from a drop-down menu) and then run the required macro
(one for each day of the week). Any ideas
Thanks
--
Howard



All times are GMT +1. The time now is 06:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com