Posted to microsoft.public.excel.programming
|
|
Fill a column in a worksheet from a formula worksheet based on the date
Hi Don,
do I apply what's below to my current VB? or do I delete everything I have
and use yours?
thanks so much
Don Guillett wrote:
This should work for the current month from anywhere in the workbook. It
will not work for March if you wait until April but you can change the mm
variable.
Sub findfirstdate()
Set frng = Sheets("sourcesheet").Columns(1)
Set trng = Sheets("destinationsheet").Columns(1)
my = Year(Date)
mm = Month(Date)
fr = Application.Match(CDbl(DateSerial(my, mm, 1)), frng, 1) + 1
lr = Application.Match(CDbl(DateSerial(my, mm + 1, 1)), frng, 1) - 1
dr = Application.Match(CDbl(DateSerial(my, mm - 1, 31)), trng, 1) + 1
Sheets("sourcesheet").Rows(fr & ":" & lr). _
Copy Sheets("destinationsheet").Rows(dr)
End Sub
I need help, I don’t know what I am doing wrong. What I want to do is copy
a
[quoted text clipped - 73 lines]
End Sub
|