Input, copy, new book?
JonathanK1 wrote:
Auric__;1609865 Wrote:
JonathanK1 wrote:
-
Is there a way for it to pull the headers as well? There's quite a
bit
of data in the rows so it's tough to tell what's what in the new
workbook without them.-
Sub copier()
Dim TheAnswer As String
Dim working As Worksheet, dumping As Workbook
Set working = ActiveSheet
TheAnswer = LCase$(InputBox("State?"))
Set dumping = Workbooks.Add
'***YOU MUST ADJUST THIS LINE***
For x = 1 To (number of header rows)
working.Rows(x).EntireRow.Copy
dumping.Activate
ActiveSheet.Paste
ActiveCell.Offset(1).Select
Next
For x = 1 To working.Cells.SpecialCells(xlCellTypeLastCell).Row
If LCase$(working.Cells(x, 8).Value) = TheAnswer Then
working.Rows(x).EntireRow.Copy
dumping.Activate
ActiveSheet.Paste
ActiveCell.Offset(1).Select
End If
Next
Application.CutCopyMode = False
End Sub
Excellent. Thanks again!
No prob. I suggest you read thru what Garry ("GS") wrote; he has a point
about using Variants.
--
I never killed anyone. I avoid going over that edge by
writing about a guy who has taken a flying leap over it.
|