Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
 
Posts: n/a
Default VBA code to sum a row: syntax needed

I've got some code going, and need to perform a function if the sum of
cells between columns DZ and EP on every row exceeds zero. What is the
code to sum a range?

Range("dz" & selection.row).value + Range("ea" & selection.row).value +
etc is too cumbersome. What's the better way?

Thanks!

  #2   Report Post  
Trevor Shuttleworth
 
Posts: n/a
Default

One way:

Sub test()
With Selection
Range("dx" & .Row) = WorksheetFunction.Sum _
(Range("dz" & .Row & ":ep" & .Row))
End With
End Sub

Regards

Trevor


wrote in message
ups.com...
I've got some code going, and need to perform a function if the sum of
cells between columns DZ and EP on every row exceeds zero. What is the
code to sum a range?

Range("dz" & selection.row).value + Range("ea" & selection.row).value +
etc is too cumbersome. What's the better way?

Thanks!



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
Using other workbooks.. DavidMunday Excel Worksheet Functions 2 July 1st 05 07:35 AM
School-boy secret code help needed Anthony Slater Excel Discussion (Misc queries) 5 May 23rd 05 02:56 PM
Make Change Case in Excel a format rather than formula Kevin Excel Worksheet Functions 1 March 18th 05 08:53 PM
formula / code help needed Paul Watkins Excel Discussion (Misc queries) 2 March 16th 05 08:27 PM
syntax question - cell references in VB code needyourhelp New Users to Excel 1 March 2nd 05 08:52 PM


All times are GMT +1. The time now is 12:08 PM.

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"