Thread: VB Code
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default VB Code

today is for functions. Use DATE as you did in part of the code. also get
rid of selections.

If Cells(13, 2) = date - 3 or cells(13,2)=date-1 Then GoTo My_Procedure
My_Procedu
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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"chrisnsmith" wrote in message
...
What's wrong with this code?

Private Sub UpdateForm200()
If Cells(13, 2) = Today - 3 Then GoTo My_Procedure
ElseIf Cells(13, 2) = Today - 1 Then GoTo My_Procedure
End If

My_Procedu
Sheets("Cus Futures").Select
Range(" H9:I50").Copy Range("D9:E50")
Range("F9:I50").ClearContents
Range("M2") = Date
'
'
Sheets("House Futures").Select
Range(" H9:I50").Copy Range("D9:E50")
Range("F9:I50").ClearContents
Range("M2") = Date