I have a large set of data that is broken into regions that have a number value. ie 11, 15, 18 for example. I have code that will pull certain columns from this data set and place it into a new sheet, but it is coded in a way that if new data entry is input into a row it will screw up the entire thing. I would like to know if there is a way to have an input box that will search for a region number in Column A and then pull the given columns like in the previous code and place it onto a new sheet.
sample of the original code is:
If Newname = "15" Then
Sheets.Add Type:=xlWorksheet
ActiveSheet.Name = Newname
Worksheets("PivTbl 2").Range("A5,A51:A56").Copy Worksheets(Newname).Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
Worksheets("PivTbl 2").Range("b5,b51:b56").Copy Worksheets(Newname).Cells(Rows.Count, "A").End(xlUp).Offset(-6, 1)
Worksheets("PivTbl 2").Range("i5,i51:i56").Copy Worksheets(Newname).Cells(Rows.Count, "A").End(xlUp).Offset(-6, 2)
Worksheets("PivTbl 2").Range("j5,j51:j56").Copy Worksheets(Newname).Cells(Rows.Count, "A").End(xlUp).Offset(-6, 3)
Worksheets("PivTbl 2").Range("k5,k51:k56").Copy Worksheets(Newname).Cells(Rows.Count, "A").End(xlUp).Offset(-6, 4)
Worksheets("PivTbl 2").Range("r5,r51:r56").Copy Worksheets(Newname).Cells(Rows.Count, "A").End(xlUp).Offset(-6, 5)
Worksheets("PivTbl 2").Range("s5,s51:s56").Copy Worksheets(Newname).Cells(Rows.Count, "A").End(xlUp).Offset(-6, 6)
Worksheets("PivTbl 2").Range("t5,t51:t56").Copy Worksheets(Newname).Cells(Rows.Count, "A").End(xlUp).Offset(-6, 7)
End If
Bookmarks