I want to say thank you Zurn, Bob, Ivan & Rick for responded to my row
variable need. I'm getting there, but now another problem surfaced after
adding the variable row code.
What I am trying to achieve is as follows:
1. I first open the PAS DATA workbook with Excel.
2. I then run the macros to (1) Open a new workbook based on a template
named CSR_Report.xlt, which creates a workbook named CSR_Report1.
3. I then want to select/copy specific columns and all rows starting from A2
from the PAS Data workbook.
4. I then want to paste the PAS Data into the workbook CSR_Report1 at
column/row A2. This is where my next problem begins. The code Activates the
window for the CSR_Report1, but the next line of code that is to select the
range on that worksheet produces a "Runtime error '1004'. Below is the
current code. Can anyone help with the next problem?
************
Sub CSRData()
'
' Macro recorded 4/25/2006'
Workbooks.Add Template:= _
"C:\Documents and Settings\Owner\My documents\PAS\CSR_PAS_Report.xlt"
End Sub
***************************************
Sub CopyPAS()
'
' Macro recorded 4/25/2006
Windows("PAS Data.xls").Activate
Set rng1 = Range("a2:U2")
Set rng1 = Range(rng1, rng1.End(xlDown))
Selection.Copy
Windows("CSR_PAS_Report1").Activate
Range("A2").Select 'this is where the code fails
ActiveSheet.Paste
Selection.AutoFilter Field:=19, Criteria1:=">=0", Operator:=xlAnd, _
Criteria2:="<=30"
Range("C:C,E:E,F:F,G:G,J:J,K:K,L:L,M:M,S:S").Select
Selection.EntireColumn.Hidden = True
End Sub
TIA
Jan
Bookmarks