Macro for specific condition

philky001

Board Regular
Joined
Jun 8, 2005
Messages
129
HI I have an excel sheet with this data, 5 columns per date. 48's are how many visits were billed within 48 hours and after. Some cases the program creating this will have data for Tot_billed, but nothing in the 48's. This is impossible. What I want to do is run a macro that says, if the Tot_billed is not = 0, and the 48's are both 0, add to the >48 the number in the Tot_billed.


Dr Name
date visits <48 >48 Tot_billed Not Billed
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Untested, but simple:
Code:
Sub SomethingAbout48s()
    Dim i As Integer
    Dim finalRow As Integer
    
    finalRow = Cells(Rows.Count, 1).End(xlUp).Row
    
    For i = 2 To finalRow
        If Cells(i, 2).Value = 0 And Cells(i, 3).Value = 0 And Cells(i, 4).Value > 0 Then
            Cells(i, 3).Value = Cells(i, 3).Value + Cells(i, 4).Value
        End If
    Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,580
Messages
6,125,654
Members
449,245
Latest member
PatrickL

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