View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mat P:son[_2_] Mat P:son[_2_] is offline
external usenet poster
 
Posts: 97
Default copy entire row to another workbook

Well, as a first step, I would suggest that you enable the DisplayAlerts
property temporarily to be able to see what prompts you get from Excel. That
might help you quite a bit.

What error message do you get by the way?

Cheers
/MP

"Craig" wrote:

I'm trying to copy all rows in a workbook into a seperate workbook
based on a date column, and an entered date range. I want to have this
loop so that it will get all rows, but I keep getting errors, or dates
that don't fall withing the date range being copied. Here's what i
have so far, with the date range being on the DATA sheet in b8 for
beginning and b9 for ending, right now it's erroring out on
activesheet.paste, any ideas?

Sub PullDown()
Dim UsedRng As Range
Dim LastRow As Long
Dim E As Range
Dim mySheet As String
With Application
.CutCopyMode = False
.ScreenUpdating = False
.DisplayAlerts = False
End With
mySheet = ActiveSheet.Name
Sheets("DATA").Activate
BegDate = [B8].Value
EndDate = [b9].Value
Workbooks("project request.xls").Activate
LastRow = Cells(Rows.Count, "b").End(xlUp).Row
Set UsedRng = Range("B2:B" & LastRow)
For Each E In UsedRng
If E.Value = BegDate Then
If E.Value <= EndDate Then Range(E,
ActiveCell.End(xlToRight)).select
Selection.Copy
Workbooks("support by project.xls").Activate
If ActiveSheet.Name < mySheet Then
Sheets(mySheet).Activate
Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Paste
ActiveSheet.Paste
End If
Next E
End Sub