+ Reply to Thread
Results 1 to 2 of 2

VBA code to sum a row: syntax needed

  1. #1
    slingsh0t@hotmail.com
    Guest

    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. #2
    Trevor Shuttleworth
    Guest

    Re: VBA code to sum a row: syntax needed

    One way:

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

    Regards

    Trevor


    <slingsh0t@hotmail.com> wrote in message
    news:1121100498.474432.58060@o13g2000cwo.googlegroups.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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1