Judgeh59 you helped me create this, and it works well.. Thanks.. except i forgot one little detail
That causes it to pull wrong data..
I need for it to pull only the data adjacent to the 0 in Row A.. So if there is a 0 then run this script.. Yes Still need to pull the
header data.. but the rest of the data has to start at the point where there is a 0 in row A..right now it starts at the very top.
If you look at the spreadsheet I attached.. the fields colored in blue and have a 1 next to them in column A should not be pulled.
here is the current code
Sub CreatTab()
Dim Names()
Dim x As Integer
Dim LastRow As Single, TempLastRow As Single, y As Single
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Names = Array("VA", "100", "IL", "200", "CA", "300", "NJ", "400", "PR", "500", "TX", "600", "Warranty", "900")
For x = 0 To UBound(Names) Step 2
Range("b2:Y2").Select
Selection.Copy
Sheets.Add After:=Sheets(Sheets.Count)
ActiveSheet.Name = Names(x)
Range("b2").Select
ActiveSheet.Paste
Sheets("Sheet1").Activate
Next x
LastRow = Cells(65000, 1).End(xlUp).Row
For x = 0 To UBound(Names) Step 2
For y = 3 To LastRow
If Left(Cells(y, 2).Value, 3) = Names(x + 1) And Cells(y, 1).Value = 0 Then
TempLastRow = Sheets(Names(x)).Cells(65000, 2).End(xlUp).Row
Range("B" & y & ":" & "Y" & y).Select
Selection.Copy
Sheets(Names(x)).Activate
Cells(TempLastRow + 1, 2).Select
ActiveCell.PasteSpecial
Sheets("Sheet1").Activate
End If
Next y
Next x
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
File attached..
Bookmarks