i am writing a macro which asks the user to input the names of engineers and calculate how many shifts they have been working. i can get up a message box which asks for the names and i can workout the averages, but how do i put these results into cells on an excel spreadsheet. it will only enter the first engineers name and not any others:
Sub Target_Count()
Dim Count As Integer
Dim Target As String
Dim Cell As Object
Dim N As Integer
Do
Count = 0
Target = InputBox("engineer(s) to find?")
If Target = "" Then GoTo Done
For Each Cell In Selection
N = InStr(1, Cell.Value, Target)
While N <> 0
Count = Count + 1
N = InStr(N + 1, Cell.Value, Target)
Wend
Next Cell
MsgBox Count & " Occurrences of " & Target
Done:
Loop Until Target = "end"
Run "countcolumns"
End Sub
Sub Target_Count()
Dim Count As Integer
Dim Target As String
Dim Cell As Object
Dim N As Integer
Do
Count = 0
Target = InputBox("engineer(s) to find?")
If Target = "" Then GoTo Done
For Each Cell In Selection
N = InStr(1, Cell.Value, Target)
While N <> 0
Count = Count + 1
N = InStr(N + 1, Cell.Value, Target)
Wend
Next Cell
MsgBox Count & " Occurrences of " & Target
Done:
Loop Until Target = "end"
Run "countcolumns"
End Sub