November 17, 2017

How to Add Data in Non Contiguous Cells with VBA

How to add or sum data in non contiguous or non continuous cells in an Excel worksheet using VBA. Earlier we had learnt how to copy non contiguous cells and paste them in another worksheet. Watch the video:


Watch this video on YouTube.

Here’s the VBA macro code:

Sub addNonContiguousCellsData()
Range(“j1”) = WorksheetFunction.Sum(Range(“B7, B8, A12, B12, C12, D12, F12, H12, H7, H8”))
End Sub