Help me ! Basic VBA Query ......
This code will do what you require, assuming there are
only 20 rows on your first sheet and all the entries in
column A are numbers. If the number can change then amend
X = 2 to 20 to
X = 2 to application.worksheetfunction.counta(sheets
(1).Columns(1))-1
Sub PickARow()
Dim X As Integer
Dim y As Integer
Dim WhichCC As Integer
y = 2
WhichCC = InputBox("Which CC do you want to view data
for?")
Sheets(2).Rows("2:100").ClearContents
For X = 2 To Application.WorksheetFunction.CountA(Sheets
(1).Columns(1))
If Sheets(1).Cells(X, 1).Value = WhichCC Then
Rows(X).Copy Destination:=Sheets(2).Cells(y, 1)
y = y + 1
End If
Next X
End Sub
Cheers, Pete
|