View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Help With VBA Copy Code

To work with your previously posted style:

Sub test()
CopyPlayer "HidRatings", "PR Current", "12", "RB", "C", "2"
End Sub


Sub CopyPlayer(ByVal copyfromname As String, _
ByVal copytoname As String, _
ByVal copytorow As Long, _
ByVal position As String, _
ByVal columnsearch As String, _
ByVal StartRow As Long)

Dim myR As Range
With Worksheets(copyfromname)
.Range("A" & StartRow - 1).CurrentRegion.AutoFilter _
Field:=Cells(1, columnsearch).Column, Criteria1:="=" & position
Set myR = Intersect(.UsedRange, .Range("A" & StartRow & ":P" &
Rows.Count)) _
.SpecialCells(xlCellTypeVisible)
myR.Copy
End With
With Worksheets(copytoname)
.Range("A" & copytorow).PasteSpecial xlPasteValues
End With
Application.CutCopyMode = False
End Sub


HTH,
Bernie
MS Excel MVP


"CribbsStyle" wrote in message
...
How would I go about filtering, and I need this to all happen behind
the scenes in VBA.

Yeah I know where the table is...

HidRatings.Range(A2:P90)

Column C has the value Im searching for

Column is mostly filled...there are a few that are not filled, I could
just delete them.

No full blank rows or columns