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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

venkat1926

Well-known Member
Joined
Aug 21, 2005
Messages
4,824
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..
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,273
Messages
5,836,329
Members
430,421
Latest member
Natas

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
Top