Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bob
Thanks The programme appears to be adding the number of occurences in a row of the 0 digit and deducting 1 when I run it. I need to sum all the data to the left of the 1st (leftmost) 0 in a row and enter that data into column 1. Thanks again. Tom "Bob Phillips" wrote: I am reading this slightly differently to Gary Sub SumCells() Const thisRow As Long = 10 '<=== change to suit Dim iLastCol As Long Dim nSum As Double Dim i As Long iLastCol = Cells(thisRow, Columns.Count).End(xlToLeft).Column For i = 2 To iLastCol If Cells(thisRow, i).Value = 0 And _ Cells(thisRow, i).Value < "" Then nSum = nSum + Cells(thisRow, i - 1).Value End If Next i MsgBox nSum End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Tom London" <Tom wrote in message ... I have a workbook full of data. I want to sum the data to the left of cells containing 0. The 0 occurs randomly. Any solutions appreciated but am learning VBA at the moment and would particularly appreciate a VBA solution. Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to vlookup of one cell by starting 2 digits of another cell? | Excel Worksheet Functions | |||
Macro for cell selection starting with Last Cell | Excel Worksheet Functions | |||
I want to sort Data A-Z starting at Cell A1 to C34 | Excel Discussion (Misc queries) | |||
Cell data required upon close | Excel Programming | |||
Change Cell Data of a Required Column | Excel Programming |