ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How run Evaluate on a specified Sheet (https://www.excelbanter.com/excel-programming/356949-how-run-evaluate-specified-sheet.html)

shishi

How run Evaluate on a specified Sheet
 
Hi all,
I am trying to run Evaluate on a sheet that is not currently active. I
have a formula stored as a String. The Evaluate function works great on
the currently active sheet. But when I try to attempt the same Evaluate
function on another sheet, it fails..

Dim fStr As String
Dim listing As Variant
Dim rng As Range
Dim codeSheet As String

listing = Evaluate(ThisWorkbook.Sheets(codeSheet)!fStr)
Here fStr is the expression to evaluate. This is not working. If I
remove the ThisWorkbook.Sheets(codeSheet)!, it will just work fine, but
always works only on the active sheet. Please advise me how I can
correct this.

Thanks in advance,

shishi



All times are GMT +1. The time now is 04:49 AM.

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