LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Need help with Syntax

Hello:

I have a workbook which has three worksheets. Each
worksheet has several cells which have comments in them.
I have a toggle button on each of the worksheets which I
want to use to alternately show and hide all of the
comments on the worksheet.

Here is the VBA for the toggle buttons (all three are the
same:

Private Sub ToggleButton1_Click()
If ToggleButton1.Value = True Then
Call ShowComments
Else
Call HideComments
End If
End Sub

The macros "ShowComments" and "HideComments" were
recorded. They look like this:

Sub ShowComments()
Application.DisplayCommentIndicator =
xlCommentAndIndicator
End Sub

Sub HideComments()
Application.DisplayCommentIndicator =
xlCommentIndicatorOnly
End Sub

This works, but the problem with this is that each button
shows and hides all of the comments on every worksheet.
I want each button to show and hide the comments only on
the worksheet on which it is located.

I know I need to replace the "Application" in the
recorded macros with some sort of Workbooks
(ActiveWorkbook.Name) and Sheets(ActiveSheet.Name)
combination. I tried this:

Sub ShowComments()
Dim MYSHEET as Object
MYSHEET = Workbooks(ActiveWorkbook.Name).Sheets
(ActiveSheet.Name)
MYSHEET.DisplayCommentIndicator =
xlCommentAndIndicator
End Sub

{and repeat the syntax for the other macro}

but I can't get it to work.

Ideas?

Thanks,
MARTY
 
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
vba syntax Derrick Excel Discussion (Misc queries) 11 August 5th 09 08:37 PM
The NOW() syntax Tom Excel Discussion (Misc queries) 3 January 4th 08 04:10 PM
IRR Syntax Bruce Excel Worksheet Functions 1 July 13th 07 09:02 PM
Syntax Help Dmorri254 Excel Worksheet Functions 2 March 2nd 05 02:51 PM
Help with VBA syntax jacqui[_2_] Excel Programming 3 January 13th 04 02:29 PM


All times are GMT +1. The time now is 11:06 PM.

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"