VBA formula

hocs

New Member
Joined
Nov 13, 2009
Messages
33
Hi,
How to 'convert' this formula to work in VBA code:
In cell H4, the formula is:
=IF(OR(B4=0,C4=0,D4=0,E4=0,F4=0,G4=0),"Incomplete Invoice", IF(C4>E4,"D.O.Date>Invoice Date?", C4+G4))

How to write this formula in VBA module?
(Note: H4 is date)

Thanks!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Try

Code:
If Range(B4) = 0 Or Range(C4) = 0 Or Range(D4) = 0 Or Range(E4) = 0 Or Range(F4) = 0 Or Range(G4) = 0 Then
    MyCell = "Incomplete Invoice"
ElseIf Range(C4) > Range(E4) Then
    MyCell = "D.O.Date>Invoice Date?"
Else
    MyCell = Range(C4) + Range(G4)
End If
 
Upvote 0

Forum statistics

Threads
1,216,503
Messages
6,131,020
Members
449,615
Latest member
Nic0la

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