Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I'm having a problem with the If and Elseif functions.
When I enter the following everything works fine. If Weekday(Date, vbMonday) = 1 And Worksheets("Cus Futures") _ ..Cells(13, 2).Value = Date - 3 Then With Sheets("Cus Futures") .Range(" H9:I50").Copy Range("D9:E50") .Range("F9:I50").ClearContents ..Range("M2") = Date End With ' ' With Sheets("House Futures") .Range(" H9:I50").Copy Range("D9:E50") .Range("F9:I50").ClearContents ..Range("M2") = Date End With ElseIf Weekday(Date,vbMonday) = 2 < 7 And Worksheets("Cus Futures") _ ..Cells(1, 1).Value = Date -1 Then With Sheets("Cus Futures") .Range(" H9:I50").Copy Range("D9:E50") .Range("F9:I50").ClearContents ..Range("M2") = Date End With ' ' With Sheets("House Futures") .Range(" H9:I50").Copy Range("D9:E50") .Range("F9:I50").ClearContents ..Range("M2") = Date End With I only list two worksheets for simplicities sake, however I have 31 worksheets that need to be updated daily. So I have placed all worksheets to update in a module called UpdateForms and did the following. I changed my If statement to; If Weekday(Date, vbMonday) = 1 And Worksheets("Cus Futures") _ ..Cells (1, 1). Value = Date -3 Then Call UpdateForms End if When I run this I get a message End If without a block If. I changed both my If statement and Elseif statement to: If Weekday(Date, vbMonday) = 1 And Worksheets("Cus Futures") _ ..Cells (1, 1). Value = Date -3 Then Call UpdateForms Elseif Weekday(Date, vbMonday) =2 < 7 And Worksheets("Cus Futures") _ ..Cells (1, 1).Value = Date - 1 Then Call UpdateForms When I run this code I get a similar message Else without an If. What am I doing wrong and how do I correct it? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Elseif? | Excel Worksheet Functions | |||
Compile Error ElseIf Without If.........But there is an If ! ??? | Excel Discussion (Misc queries) | |||
if elseif | Excel Discussion (Misc queries) | |||
elseif formula | Excel Discussion (Misc queries) | |||
SP3 problems | Excel Discussion (Misc queries) |