slifer666
Board Regular
- Joined
- Sep 29, 2005
- Messages
- 81
ok i've got this line in a macro:
the purpose is to check if today is a monday. monday being the 2nd day of the week, according to the weekday() function
but it gives this VB error when editing the macro:
Compile Error
Expected: end of statement
and it has highlighted the 'Monday'
the thing that's bugging me, if i put this line into an edit box of a cell directly, it works:
and i have other functions in the same macro which have the same format, and also work, eg:
any idea why i'm getting this error? i reckon its something really straightforward but i can't see it at the minute.
many thanks
Code:
Range("N1").Select
ActiveCell.FormulaR1C1 = "=IF(WEEKDAY(TODAY())=2,"Monday","")"
the purpose is to check if today is a monday. monday being the 2nd day of the week, according to the weekday() function
but it gives this VB error when editing the macro:
Compile Error
Expected: end of statement
and it has highlighted the 'Monday'
the thing that's bugging me, if i put this line into an edit box of a cell directly, it works:
Code:
=IF(WEEKDAY(TODAY())=2,"Monday","")
and i have other functions in the same macro which have the same format, and also work, eg:
Code:
Range("O3").Select
ActiveCell.FormulaR1C1 = "=TODAY()-1"
any idea why i'm getting this error? i reckon its something really straightforward but i can't see it at the minute.
many thanks