View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Move Range with a date to a Matching Monthly Worksheet

Sub movebydate()

RowCount = 1
With Sheets("Archive")
Do While .Range("L" & RowCount) < ""
.Range("A" & RowCount & ":P" & RowCount).Copy
mnthname = Format(.Range("L" & RowCount), "mmmm")
With Sheets(mnthname)
If .Range("A1") = "" Then
.Paste Destination:=.Range("A1")
Else
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
NewRow = LastRow + 1
.Paste Destination:=.Range("A" & NewRow)
End If
End With
RowCount = RowCount + 1
Loop

End With

End Sub


"RyanH" wrote:

I believe this may be a simple loop, but I am not sure how to finish it. I
have a Worksheet("Archive") that contains a history of all product orders.
The entire Worksheet is Sorted by ship date (January -- December). In the
same workbook I have a WorkSheet for every month of the year, named:
"January", "Febuary", "March", etc. What I want to do is build a loop that
will scan down Sheets("Archive").Column(L:L), which contains the ship date,
and Cut the Range("A:P") and paste values only in the month the date belongs.
Is this possible?

Note: The ship dates are in this format, m/dd/yy.

I'm sure this loop will work much faster if there is a Do...Until loop,
because the Worksheet("Archive") is sorted by ship date!