PianoMan5
07-25-2012, 12:07 PM
Sub FillDown()
Dim LastCOF As Long
Dim PasteCOF As Integer
Dim FirstRow As Long
Dim LastRow As Long
Dim COF As Integer
Dim GroupMove As String
Dim CopyCOF As Integer
LastCOF = Sheets(2).UsedRange.Rows.Count
Application.ScreenUpdating = False
For COF = 2 To LastCOF
GroupMove = Sheets(2).Cells(COF, 3)
Sheets(3).Select
FirstRow = Sheets(3).Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
Worksheets("HOLD").Select
Sheets(1).Rows("3:3").AutoFilter
Sheets(1).Range("F:F").AutoFilter Field:=1, Criteria1:=GroupMove
Sheets(1).Rows("4:65000").Copy Destination:=Sheets(3).Cells(FirstRow, 1)
Sheets(1).Rows("3:3").AutoFilter
Sheets(3).Select
LastRow = Worksheets(3).Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
For CopyCOF = FirstRow To LastRow
Cells(CopyCOF, 6) = Sheets(2).Cells(COF, 2)
Next
Next
Application.ScreenUpdating = True
End Sub
Above is the code that I'm having trouble with...I got so frustrated that I made it line by line so I apologize with how elementary it looks.
Anyways, I want the macro to look at each value in column B on a specific sheet (account#), see what's in the cell next to it (group), and look at another sheet and do a bulk copy of all values that's in the group and paste it to a new sheet with the account# to the left...in laymens terms, I don't want to have to copy something 1000 times over.
Any help? :doh:
Dim LastCOF As Long
Dim PasteCOF As Integer
Dim FirstRow As Long
Dim LastRow As Long
Dim COF As Integer
Dim GroupMove As String
Dim CopyCOF As Integer
LastCOF = Sheets(2).UsedRange.Rows.Count
Application.ScreenUpdating = False
For COF = 2 To LastCOF
GroupMove = Sheets(2).Cells(COF, 3)
Sheets(3).Select
FirstRow = Sheets(3).Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
Worksheets("HOLD").Select
Sheets(1).Rows("3:3").AutoFilter
Sheets(1).Range("F:F").AutoFilter Field:=1, Criteria1:=GroupMove
Sheets(1).Rows("4:65000").Copy Destination:=Sheets(3).Cells(FirstRow, 1)
Sheets(1).Rows("3:3").AutoFilter
Sheets(3).Select
LastRow = Worksheets(3).Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
For CopyCOF = FirstRow To LastRow
Cells(CopyCOF, 6) = Sheets(2).Cells(COF, 2)
Next
Next
Application.ScreenUpdating = True
End Sub
Above is the code that I'm having trouble with...I got so frustrated that I made it line by line so I apologize with how elementary it looks.
Anyways, I want the macro to look at each value in column B on a specific sheet (account#), see what's in the cell next to it (group), and look at another sheet and do a bulk copy of all values that's in the group and paste it to a new sheet with the account# to the left...in laymens terms, I don't want to have to copy something 1000 times over.
Any help? :doh: