Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default R/T Error encounter - Posted originally to functions ng - in error

Sub SumByEmployee()
Dim MyPick As String
Dim mTotal As Double
Dim rngemp As Range
mTotal = 0
MyPick = InputBox("What Employee Do you Want?")
Set rngemp = Range("C6:C15") 'list of employees - single names
For Each c In rngemp
If c = MyPick Then
mTotal = mTotal + rngemp.Offset(, -1).Value 'R/T error happens here
End If
Next c
Range("B18").Value = mTotal
End Sub

Thanks for any help!!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default R/T Error encounter - Posted originally to functions ng - in error

I think I got it; changed line to:
mTotal = mTotal + c.Offset(, -1).Value


"Jim May" wrote in message
news:dq0zd.9985$jn.6753@lakeread06...
Sub SumByEmployee()
Dim MyPick As String
Dim mTotal As Double
Dim rngemp As Range
mTotal = 0
MyPick = InputBox("What Employee Do you Want?")
Set rngemp = Range("C6:C15") 'list of employees - single names
For Each c In rngemp
If c = MyPick Then
mTotal = mTotal + rngemp.Offset(, -1).Value 'R/T error happens here
End If
Next c
Range("B18").Value = mTotal
End Sub

Thanks for any help!!




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default R/T Error encounter - Posted originally to functions ng - in error

try this simpler version

Sub SumByEmployee()
MyPick = InputBox("What Employee Do you Want?")
For Each c In Range("C6:C15")
If c = MyPick Then mTotal = mTotal + c.Offset(, -1)
Next c
Range("B18") = mTotal

--
Don Guillett
SalesAid Software

"Jim May" wrote in message
news:dq0zd.9985$jn.6753@lakeread06...
Sub SumByEmployee()
Dim MyPick As String
Dim mTotal As Double
Dim rngemp As Range
mTotal = 0
MyPick = InputBox("What Employee Do you Want?")
Set rngemp = Range("C6:C15") 'list of employees - single names
For Each c In rngemp
If c = MyPick Then
mTotal = mTotal + rngemp.Offset(, -1).Value 'R/T error happens here
End If
Next c
Range("B18").Value = mTotal
End Sub

Thanks for any help!!




Reply
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
Error encounter when i try to click a hyperlink in Excel vic Excel Discussion (Misc queries) 0 December 13th 07 09:04 AM
Help with #Value error when calling custom functions Carlos Galvez Excel Programming 1 September 9th 04 10:42 PM
sort (on part of) string - originally posted under Tricky Sort Tom Ogilvy Excel Programming 0 August 6th 04 02:42 AM
Returning Error from Functions LeninVMS[_4_] Excel Programming 3 April 9th 04 06:27 PM
Deleting Blank Cells Subject to Criteria (Originally Posted in Excel by Mistake) Mark Excel Programming 3 April 7th 04 03:51 PM


All times are GMT +1. The time now is 06:29 AM.

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

About Us

"It's about Microsoft Excel"