Need help with VB code to Excel document

melanemac

Registered User.
Local time
Today, 11:15
Joined
Feb 17, 2005
Messages
14
I have a programmer developed database that I need to update on occasion. There is currently a field that is being input from Access VB into the Excel document that is writing a "hard" field". Instead I want a calculation. I want the cell to read the following formula when complete:

=IF(K102<L102,"Below",IF(K102>N102,"Above","In"))

What I have in Access so far is:
.Range("Base_RangeFit").Offset(n, 0).Formula = "= if(" & Replace(.Range("FTE_Base_Salary").Offset(n, 0).Address, "$", "") & "<" & Replace(.Range("Base_Lower").Offset(n, 0).Address, "$", "") & ", "Below" , if(" & Replace(.Range("FTE_Base_Salary").Offset(n, 0).Address, "$", "") & ">" & Replace(.Range("Base_Upper").Offset(n, 0).Address, "$", "") & ", "Above" , "In" ))"

The problem lies in the Red text. I can't have the quotations, because it is using quotations to give the instructions. Problem is I need the quotations in the Excel formula.

Any ideas?
 
Try single quotes around those.
 
I tried that and it didn't work...it errored out on me. Besides, I need the double quotes to show up in Excel.
 
Ah, didn't think Excel would care. Then you should be able to put Chr(34) in for each one.
 

Users who are viewing this thread

Back
Top Bottom