inputing data

sach_k

New Member
Joined
Jul 4, 2008
Messages
38
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
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
from a quick glance of your macro it looks that you have to input the name of the engineers one by one and run the macro.

if you want a macro to read all the names one by one and give the results in anoher location then create code statements to read each enginners' name one by one and find out the no. of shift for each of them

It would be helpful if you can post a SMALL EXTRACT of your database suing htmlmaker..
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,716
Members
448,985
Latest member
chocbudda

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top