LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default SUM in VBA

I am trying to sum col L on Data Sheet if Col A on Sales Reps matches Col K
on Data Sheet.. I have attempted it below but i failed. Any help?

Code:
  With Range("L2:L5000")
   sumL = 0
'assuming the row range is 2 to 5000
For r = 2 To 5000
  If Cells(Worksheets("Sales Reps")(r, 1)).Value = Cells(Worksheets("Data 
Sheet")(r, 11)) Then
    sumL = sumL + Cells(Worksheets("Data Sheet")(r, 80)).Value
  End If
Next
 
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



All times are GMT +1. The time now is 12:27 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"