Ok, so this isn't working right now....and I can't figure out why. Here is what I have.
Sub Button6_Click()
Dim TheAnswer As String
Dim working As Worksheet, dumping As Workbook
Set working = ActiveSheet
TheAnswer = LCase$(InputBox("Enter State below"))
Set dumping = Workbooks.Add
For x = 1 To 17
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
Cells.Sort Key1:=Range("C:C"), Order1:=xlAscending, _
Key2:=Range("Q:Q"), Order2:=xlDescending, Header:=xlYes
End Sub
First, when it pulls the data to the new workbook from H column (the answer to the question), it's giving more than just the answers I want - there are wrong ones mixed in. Instead of giving me all NY for example (like I input for the answer), I'm getting some others in there as well, which shouldn't happen.
Also, for column C (sort at the bottom) I'd like certain results to show first. Is this possible? So these are states and I'd like NY, MN, SC and UT to come first - the rest can go in any order after that.
|