PDA

View Full Version : Sleeper: Advanced Filter/CopyTo



RG62
12-31-2004, 10:10 AM
I am trying to create a macro that will filter and copy information from a range in a sheet (named Base Costing Sheet) to a range in a separate sheet (named Material List based on specified criteria.

I am new to using Macros/VBA code and have tried unsuccessfully to make this work, but am also learning in the process.

Please let me know what other information needed to help me.

Thanks in Advance for your assistance.

Randy

Jacob Hilderbrand
12-31-2004, 03:01 PM
What range to you want to copy, and how do you want the data filtered? To copy/paste try this.


Dim TargetRow As Long
Dim LastRow As Long
Dim CopyRange As Range
Dim PasteRange As Range
With Sheets("Material List")
TargetRow = .Range("A65536").End(xlUp).Row + 1
Set PasteRange = .Range("A" & TargetRow)
End With
With Sheets("Base Costing Sheet")
LastRow = .Range("A65536").End(xlUp).Row
Set CopyRange = .Range("A3:G" & LastRow).SpecialCells(xlCellTypeVisible)
End With
CopyRange.Copy Destination:=PasteRange