I have been trying to copy and paste selected filtered columns from one work book to another but i keep getting the same error about them not being the same size. I can copy and paste them manually but it wont let me do it through my vba code.
Can anyone please take a look and let me know if it is possible and what i have done wrong
Thank you
Here is my code
Can anyone please take a look and let me know if it is possible and what i have done wrong
Thank you
Here is my code
Code:
Sub Copy_12Met_WTL()
Dim ws As Worksheet
Dim Vac As Worksheet
Set Vac = Application.Workbooks("Vac AC").Sheets("12 Metal")
Set ws = Application.ActiveSheet
Dim str As String
str = "12""MET"
ws.Range("WTL").AutoFilter field:=3, Criteria1:="=*" & str & "*", VisibleDropDown:=True
If ws.ListObjects("WTL").Range.Columns(1).SpecialCells(xlCellTypeVisible).Count > 1 Then
Dim data_end_row_number As Long
Dim nxt As Long
data_end_row_number = ws.Range("A3").End(xlDown).Row
nxt = Vac.Range("A2").End(xlDown).Row + 1
ws.Range("D" & data_end_row_number).SpecialCells(xlCellTypeVisible).copy Destination:=Workbooks("Vac AC").Sheets("12 Metal").Range("B" & nxt)
ws.Range("A" & data_end_row_number).SpecialCells(xlCellTypeVisible).copy Destination:=Workbooks("Vac AC").Sheets("12 Metal").Range("A" & nxt)
ws.Range("E" & data_end_row_number).SpecialCells(xlCellTypeVisible).copy Destination:=Workbooks("Vac AC").Sheets("12 Metal").Range("F" & nxt)
Else
MsgBox "No Carry Over For 12 Metal Line"
End If
End Sub