LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 145
Default This is hard... well for me...Need help with a macro to summar

We did not have any problem with Bob's function.
for your benefit, we converted this function as subroutine as follow. Tested
OK

Sub t() 'Function GetTotals(Source As String, Resource
As Range, MatchDate As Range)
Dim Source As String 'added
Dim Resource As Range 'added
Dim MatchDate As Range 'added
Dim i As Long
Dim iLastrow As Long
Dim iStart As Long
Dim iEnd As Long
Dim tmp

Source = "sheet1" 'added
Set Resource = Range("A2") 'added
Set MatchDate = Range("B1") 'added

iLastrow = Worksheets(Source).Cells(Worksheets(Source).Rows.C ount,
"A").End(xlUp).Row
On Error Resume Next
iStart = Application.Match(Resource.Value,
Worksheets(Source).Range("B:B"), 0)
If iStart 0 Then
iEnd = Application.Match("Agent:", Worksheets(Source).Range("A" &
iStart + 1 & ":A" & Rows.Count), 0) + iStart
If iEnd = 0 Then
iEnd = iLastrow
End If
On Error GoTo 0
For i = iStart To iEnd
If Worksheets(Source).Cells(i, "A").Value = MatchDate.Value Then
tmp = CDate(Worksheets(Source).Cells(i, "G").Value)
End If
Next i
End If
' GetTotals = tmp
Range("b2") = tmp 'added

End Sub

You have to adjust the code to suit your need. Currently it works for
range("B2") only


"Dorn" wrote in message
...
Unfortunately I haven't used user defined functions before (haha I'm

pretty
sure this should be on the newbie discussion board) I tried to save it as

a
macro and it gave me a "syntax error" and highlights the first row. As

for
the columns k through n they reflect the employees status in our phone
system, logged in is self explanatory, acd means that they will be

randomly
distributed phone calls of callers who call our sales teams non acd means
they will only receive calls intended only for them and dnd means they

won't
receive calls. I was hoping to be able to pull the time for those

categories
in the same format of the times pulled from the "total times" for each of
those dates. You guys are really helping me out here, thanks a bunch!

"PY & Associates" wrote:

Bob Phillips has given a working solution.
I trust you are happy with it.
For our curiosity, what do you expect in sheet2 columns K to N please?

"Dorn" wrote in message
...
The dates in row one could be manually entered by me, but I'm assuming

they
should be formatted as text to match the source data. As for an

example
of
what I expect in row 2, I'm having trouble with my ftp client so I'll

try
to
explain:

Under each date I need the total hours worked for that day, which is

located
in the same row as the date I just need it to copy the contents of the

cell
referenced by the date. Example would be cell G25 and for the columns

on
the
right that information can be found next to the names of the employees
example would be row 22 under the appropriate headings. Thanks for

the
help!

"PY & Associates" wrote:

Where are the DATES in row 1 come from?
Try fill up row 2 to show the result you expect please.

"Dorn" wrote in message
...
FYI: the data I need for each employee under each date is the

"total
time"
which is located on the same row as the date and in column "G" of

my
sample.









 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to summarize data krc547 Excel Worksheet Functions 7 March 31st 08 07:40 PM
Macro - Too hard for me!! Anthony Excel Discussion (Misc queries) 3 February 27th 05 07:11 AM
Macro -Far too Hard for me !! Anthony Excel Worksheet Functions 1 February 27th 05 04:21 AM
Macro - Too hard for me!! Anthony Excel Discussion (Misc queries) 0 February 27th 05 12:55 AM
Macro or VB Code to Summarize Info.from 4 workbooks Help Me Rhonda TOA[_2_] Excel Programming 1 October 9th 04 01:52 PM


All times are GMT +1. The time now is 02:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"