Adding to an existing column

philky001

Board Regular
Joined
Jun 8, 2005
Messages
129
HI I have excel data like this:

VISIT<48 >48 TOTAL BILLED NOT BILLED

10 4 3 7 3

I need a macro that will add the not-billed to the <48 i.e. 3+4= 7.
7 would replace the 4.

I tried C13=C13+F13 but it does not compile.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Assuming your data is in columns B:E
Code:
Sub t()
Dim c As Range
    For Each c In Range("C2", Cells(Rows.Count, 3).End(xlUp))
        If c.Offset(, 2) > 0 Then
            c = c.Value + c.Offset(, 2).Value
        End If
    Next
End Sub
This would add the two columns for each row when column E contains a value greater than zero.
 
Upvote 0

Forum statistics

Threads
1,215,562
Messages
6,125,546
Members
449,237
Latest member
Chase S

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top