ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date event macro. Help! (https://www.excelbanter.com/excel-programming/367477-date-event-macro-help.html)

lv619

Date event macro. Help!
 

Well after failing at using this sites useless search function i though
i may aswell start a thread.

Now, I have a cell renge of "B2:R2" which contain a series of dates t
which my workbook needs to be updated (i.e. copy data from one sheet t
a summary sheet when it's 20/07/2006, 27/07/2006 etc).

Can someone please make some suggestions on what i'm doing wrong wit
my code below (or if you could suggest a better process from m
problem).

I'm receiving a run time error where i have highlighted below, s
theirs obveously something wrong their
"Worksheets("Sheet4").Range("c4").Value" is =today() (todays date).

Thanks.

Sub test()

Dim i As Long
Dim n As Long

For i = 2 To 17
* If Cells(i, 2) = Worksheets("Sheet4").Range("c4").Value Then *
Select Case i
Case "2"
Worksheets("Sheet1").Range("d35").Copy _
Destination:=Worksheets("Sheet4").Range("b8")


Case 3
Worksheets("Sheet1").Range("d35").Copy _
Destination:=Worksheets("Sheet4").Range("b13")

......

Case 17
Worksheets("Sheet1").Range("d35").Copy _
Destination:=Worksheets("Sheet4").Range("b73")


End Select

End If
Next

End Su

--
lv61
-----------------------------------------------------------------------
lv619's Profile: http://www.excelforum.com/member.php...fo&userid=1868
View this thread: http://www.excelforum.com/showthread.php?threadid=56226


Bob Phillips

Date event macro. Help!
 
Good start, flame the forum!

I get past the code no problem. Are you sure there is a Sheet4, the values
are valid, etc.?

What error do you get.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"lv619" wrote in
message ...

Well after failing at using this sites useless search function i thought
i may aswell start a thread.

Now, I have a cell renge of "B2:R2" which contain a series of dates to
which my workbook needs to be updated (i.e. copy data from one sheet to
a summary sheet when it's 20/07/2006, 27/07/2006 etc).

Can someone please make some suggestions on what i'm doing wrong with
my code below (or if you could suggest a better process from my
problem).

I'm receiving a run time error where i have highlighted below, so
theirs obveously something wrong their.
"Worksheets("Sheet4").Range("c4").Value" is =today() (todays date).

Thanks.

Sub test()

Dim i As Long
Dim n As Long

For i = 2 To 17
* If Cells(i, 2) = Worksheets("Sheet4").Range("c4").Value Then *
Select Case i
Case "2"
Worksheets("Sheet1").Range("d35").Copy _
Destination:=Worksheets("Sheet4").Range("b8")


Case 3
Worksheets("Sheet1").Range("d35").Copy _
Destination:=Worksheets("Sheet4").Range("b13")

.....

Case 17
Worksheets("Sheet1").Range("d35").Copy _
Destination:=Worksheets("Sheet4").Range("b73")


End Select

End If
Next

End Sub


--
lv619
------------------------------------------------------------------------
lv619's Profile:

http://www.excelforum.com/member.php...o&userid=18684
View this thread: http://www.excelforum.com/showthread...hreadid=562267





All times are GMT +1. The time now is 05:00 PM.

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