Ok I have some code here. What I want it to do is to find any row that has a 3 in column A..if it does copy it over into a new tab called BSVG...
however this time I was hoping you guys could help me learn how to correct it, and therby learn code.. So i attached the program below..
So rather then just giving me the straight out answre right away maybe you can explain something to me and give me hints on how to fix it first.
file attached for clarity...
Sub CopyBsvg()
Dim Names As Variant
Dim x As Integer
Dim LastRow As Long
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Names = Array("BSVG", "3")
With Sheets("Sheet1")
LastRow = .Cells(65000, 1).End(xlUp).Row
For x = LBound(Names) To UBound(Names) Step 2
Sheets.Add(After:=Sheets(Sheets.Count)).Name = Names(x)
.Range("A2:B" & LastRow).AutoFilter 0, 3 <<=====Im sure the error has something to do with this part of the code...Hints please
.Range("A2:B" & LastRow).AutoFilter 2, Names(x + 1) & "*" <<=====Im sure the error has something to do with this part of the code...Hints please
.Range("B2:Y" & LastRow).Copy
Range("B2").PasteSpecial xlPasteColumnWidths
Range("B2").PasteSpecial xlPasteValuesAndNumberFormats
Range("B2").PasteSpecial xlPasteFormats
Range("B2").Select
Next x
.AutoFilterMode = False
Application.CutCopyMode = False
.Activate
End With
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
Sub CopyBsvg()
Dim Names As Variant
Dim x As Integer
Dim LastRow As Long
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Names = Array("BSVG", "3")
With Sheets("Sheet1")
LastRow = .Cells(65000, 1).End(xlUp).Row
For x = LBound(Names) To UBound(Names) Step 2
Sheets.Add(After:=Sheets(Sheets.Count)).Name = Names(x)
.Range("A2:B" & LastRow).AutoFilter 0, 3
.Range("A2:B" & LastRow).AutoFilter 2, Names(x + 1) & "*"
.Range("B2:Y" & LastRow).Copy
Range("B2").PasteSpecial xlPasteColumnWidths
Range("B2").PasteSpecial xlPasteValuesAndNumberFormats
Range("B2").PasteSpecial xlPasteFormats
Range("B2").Select
Next x
.AutoFilterMode = False
Application.CutCopyMode = False
.Activate
End With
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
Bookmarks