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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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,215,497
Messages
6,125,157
Members
449,208
Latest member
emmac

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