ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Formula Result Different Than Manual Formula Result (https://www.excelbanter.com/excel-programming/314015-vba-formula-result-different-than-manual-formula-result.html)

ob3ron02[_2_]

VBA Formula Result Different Than Manual Formula Result
 

I don't really understand your post, Don. Is what you're saying that
should write my code as follows (without the = sign inside the quote
for my string assignment)?
Code
-------------------
Dim ReportD As String
ReportD = "=IF(ISNA(MATCH(R[0]C[-2],PID!B:B,0))=FALSE, ""x"","""")"
Worksheets("Report").Range("D5").Offset(counter, 0).Formula = Report
-------------------
This just seems to put the string in the cells as text and no
formulas.

Thanks,

To

--
ob3ron0
-----------------------------------------------------------------------
ob3ron02's Profile: http://www.excelforum.com/member.php...fo&userid=1545
View this thread: http://www.excelforum.com/showthread.php?threadid=27047


Tom Ogilvy

VBA Formula Result Different Than Manual Formula Result
 
for the code shown:

Dim ReportD As String
ReportD = "=IF(ISNA(MATCH(R[0]C[-2],PID!B:B,0))=FALSE, ""x"","""")"
Worksheets("Report").Range("D5").Offset(counter, 0).Formula = ReportD

You have mixed R1C1 addressing and A1 addressing. Do one or the other. Don
appeared to see your requirement as being to calculate the result in VBA and
return it to the variable. It appears here that you want to put a formula
in a cell, so you need to retain the equal sign.

--
Regards,
Tom Ogilvy


"ob3ron02" wrote in message
...

I don't really understand your post, Don. Is what you're saying that I
should write my code as follows (without the = sign inside the quotes
for my string assignment)?
Code:
--------------------
Dim ReportD As String
ReportD = "=IF(ISNA(MATCH(R[0]C[-2],PID!B:B,0))=FALSE, ""x"","""")"
Worksheets("Report").Range("D5").Offset(counter, 0).Formula = ReportD
--------------------
This just seems to put the string in the cells as text and not
formulas.

Thanks,

Tom


--
ob3ron02
------------------------------------------------------------------------
ob3ron02's Profile:

http://www.excelforum.com/member.php...o&userid=15450
View this thread: http://www.excelforum.com/showthread...hreadid=270473





All times are GMT +1. The time now is 07:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com