Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
LAF
 
Posts: n/a
Default Checking if sheet is visible


I have a formula on one of my sheets that references cells on another
sheet. However, that sheet it references can be hidden sometimes and
therefore I don't want it referencing it if the sheet is not visible.
Is there a way in the formula on the sheet to check if the sheet it's
referencing is visible?


--
LAF
------------------------------------------------------------------------
LAF's Profile: http://www.excelforum.com/member.php...fo&userid=9656
View this thread: http://www.excelforum.com/showthread...hreadid=394287

  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

You could use a UserDefined Function to check for the visibility of the
worksheet.

Option Explicit
Function IsSheetVisible(rng As Range) As Variant

Application.Volatile
IsSheetVisible = CBool(rng.Parent.Visible = xlSheetVisible)

End Function


Be aware that this could be one calculation cycle out of date. Hiding/unhiding
a worksheet didn't cause a recalculation for me.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Short course:

Open your workbook.
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)

right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side

Paste the code in there.

Now go back to excel.
Into a test cell and type:
=if(issheetvisible('sheet1'!a1),'sheet1'!b99,"")

(you can use any cell on that sheet to check visibility.)


LAF wrote:

I have a formula on one of my sheets that references cells on another
sheet. However, that sheet it references can be hidden sometimes and
therefore I don't want it referencing it if the sheet is not visible.
Is there a way in the formula on the sheet to check if the sheet it's
referencing is visible?

--
LAF
------------------------------------------------------------------------
LAF's Profile: http://www.excelforum.com/member.php...fo&userid=9656
View this thread: http://www.excelforum.com/showthread...hreadid=394287


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying Specific Values From Sheet Jenn Excel Discussion (Misc queries) 1 July 11th 05 09:22 PM
How do I determine automatically that a sheet is empty? [email protected] Excel Worksheet Functions 4 May 9th 05 08:15 PM
Linking References from Multiple Sheets to One Summary Sheet Kim Setting up and Configuration of Excel 3 May 5th 05 04:56 PM
Find a non-blank cell and bring back text a in same row Rod Excel Worksheet Functions 12 March 24th 05 09:43 PM
Copy formula...sheet 2 sheet Mick New Users to Excel 0 January 26th 05 01:58 AM


All times are GMT +1. The time now is 11:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"