Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA FORMAULA w/VARIABLE SYNTAX HELP 1

Status
Not open for further replies.

Evil8

MIS
Mar 3, 2006
313
US
I have an Age Calculation:

=IF(D5 <= 0, " ", IF(D5 > 0, (ROUNDDOWN((eDate - D5)/365.25, 0))))

This is used in two of the columns on a excel 2003 worksheet. In the formula eDate above should be the value of variable taken from a UserForm run at the beginning. I am of course getting a name error. How do I get the formula to use the UserForm variable eDate?

Thank you for you time.
 
Range("A1") = "=IF(R[4]C[1] <= 0, "" "", IF(R[4]C[1] > 0, (ROUNDDOWN(([red]" & [/red]EDATE[red] & "[/red] - R[4]C[1])/365.25, 0))))"

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
I would store "eDate" on a lookup sheet - best practice is to use a named range

Code from userform

Range("EndDate").value = tbEndDate.value

Your formula is then:

=IF(D5 <= 0, " ", IF(D5 > 0, (ROUNDDOWN((endDate - D5)/365.25, 0))))

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top