I'm currently trying to create a sub that does the following:
1 - asks for an input (a string/name in this case)
2- loops through worksheets to see if their name is there, and if it is, reports their name and the "amount sold" in the column next to their name onto another worksheet.
what i have so far (i get an error with the current range i have set):
1 - asks for an input (a string/name in this case)
2- loops through worksheets to see if their name is there, and if it is, reports their name and the "amount sold" in the column next to their name onto another worksheet.
what i have so far (i get an error with the current range i have set):
Code:
[FONT=verdana]Sub question3()
Dim ws As Worksheet
Dim emprng As Range
Dim I As Integer
Dim namesearch As String
For Each ws In Worksheets
Set emprng = ws.Range(Range("A2"), Range("A2").End(xlDown))
If ws.CodeName <> "Sheet1" Then
namesearch = InputBox("Please enter the name of the employee you want to find.")
For I = 1 To emprng.Rows.Count
If emprng.Cells(I, 1) = namesearch Then
' Report the name found onto another worksheet
Else
MsgBox ("cannot find that person in the data.")
End If
Next I
End If
Next ws
End Sub[/FONT]
Last edited by a moderator: