• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

subtract every 2 col

Hi, guys, I have an array A1:E12 and I write this code to add all the columns and the results on H, and subtract all the col and the results on K. well I couldn't figure it out if I want to also add for example col A1+B1 results on "H", (I mean start another code) B1-C1 results on "I" etc.
this is the code I want to transform, I mean to see how and what "words" change, with the new request.
Code:
Option Explicit
Sub addingarray()

Dim Rw As Long, Cl As Long
For Rw = 1 To Cells(Rows.Count, "A").End(xlUp).Row
  For Cl = 1 To 6
    Cells(Rw, "H").Value = Cells(Rw, "H").Value + Cells(Rw, Cl).Value
    Cells(Rw, "K").Value = Abs(Cells(Rw, "K").Value - Cells(Rw, Cl).Value)
    Next
  Next
 
End Sub
thanks
 

Attachments

  • sum col sub col.xls
    40 KB · Views: 1
Back
Top