ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   run-time error €˜13 (https://www.excelbanter.com/excel-programming/333095-run-time-error-%E2%80%9813%E2%80%99.html)

Tim

run-time error €˜13
 
Hi folks,

When I ran the following code, I got €œrun-time error €˜13. Type mismatch€.
Could anyone tell me how to fix it?

If Evaluate("'" & strFolder & "[" & strFile & "]" & "Data" & "'!C8") =
"" Then
.Value = ""
Else
.Value = "='" & strFolder & "[" & strFile & "]" & "Data" & "'!C8"
.Value = .Value
End If


Thanks in advance.

Tim.


Tom Ogilvy

run-time error '13'
 
Evaluate doesn't work with closed workbooks.

The IF test has to be in the Formula you put in the cell.

--
Regards,
Tom Ogilvy


"Tim" wrote in message
...
Hi folks,

When I ran the following code, I got "run-time error '13'. Type mismatch"

..
Could anyone tell me how to fix it?

If Evaluate("'" & strFolder & "[" & strFile & "]" & "Data" & "'!C8") =
"" Then
.Value = ""
Else
.Value = "='" & strFolder & "[" & strFile & "]" & "Data" & "'!C8"
.Value = .Value
End If


Thanks in advance.

Tim.




Tim

run-time error '13'
 
Hi Tom,

Could you show me the code?

Thanks.

Tim.

"Tom Ogilvy" wrote:

Evaluate doesn't work with closed workbooks.

The IF test has to be in the Formula you put in the cell.

--
Regards,
Tom Ogilvy


"Tim" wrote in message
...
Hi folks,

When I ran the following code, I got "run-time error '13'. Type mismatch"

..
Could anyone tell me how to fix it?

If Evaluate("'" & strFolder & "[" & strFile & "]" & "Data" & "'!C8") =
"" Then
.Value = ""
Else
.Value = "='" & strFolder & "[" & strFile & "]" & "Data" & "'!C8"
.Value = .Value
End If


Thanks in advance.

Tim.





Tom Ogilvy

run-time error '13'
 
end result

=if(A1="","",A1)

so

ActiveCell.Formula = "=if(A1="""","""",A1)"

Obviously you would replace A1 with the string you are building.

--
Regards,
Tom Ogilvy

"Tim" wrote in message
...
Hi Tom,

Could you show me the code?

Thanks.

Tim.

"Tom Ogilvy" wrote:

Evaluate doesn't work with closed workbooks.

The IF test has to be in the Formula you put in the cell.

--
Regards,
Tom Ogilvy


"Tim" wrote in message
...
Hi folks,

When I ran the following code, I got "run-time error '13'. Type

mismatch"
..
Could anyone tell me how to fix it?

If Evaluate("'" & strFolder & "[" & strFile & "]" & "Data" & "'!C8") =
"" Then
.Value = ""
Else
.Value = "='" & strFolder & "[" & strFile & "]" & "Data" & "'!C8"
.Value = .Value
End If


Thanks in advance.

Tim.








All times are GMT +1. The time now is 05:37 AM.

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