Thread: Hidden comments
View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.misc
Oldjay Oldjay is offline
external usenet poster
 
Posts: 337
Default Hidden comments

Ken
I added the code. I didn't get any compile errors but I still can't see the
comments. Is there any chance of sending you the file. so that you can look
at it?

oldjay

"Ken Johnson" wrote:

I kept on getting an error in the event code so I just commented it
out.
When I called the code below the active cell's comment appeared.



Public Sub Pause(TargetCell As String)
Dim strAddress As String 'added line 1
'This implements a pause in code.
'We set the toggle flag and the cell reference in the
'global variable then waits until the flag is cleared.
'The flag MUST be cleared by code in the workbook's
'Change event. See Code Above for example.

'Check the flgPauseActive flag to see if we are already in a pause
If flgPauseActive Then
MsgBox "WARNING! The system is already paused waiting for a
change in cell " & TargetCell & ". Please clear that pause first.",
vbCritical + vbOKOnly, "PROGRAMMING ERROR"
Exit Sub
Else
flgPauseActive = True
End If

'We need to check and make sure we were actually passed a
'cell reference. If we are not, the thing goes on ANY modified
cell.
If Len(TargetCell) = 0 Then
MsgBox "No target cell was passed to the pause routine. Please
check the calling function and confirm that a cell is being passed as
the first parameter of the call.", vbCritical + vbOKOnly, "Failed to
pass parameter!"
Exit Sub
End If

'Set our global variables
flgToggle = True
strTargetCell = TargetCell
Application.ScreenUpdating = True
Application.DisplayAlerts = True
'Do our pause
Do
strAddress = ActiveCell.Address
DoEvents
On Error Resume Next 'added line 2
If ActiveCell.Address < strAddress Then 'added line 3
Range(strAddress).Comment.Visible = False 'added
line 4
Else: ActiveCell.Comment.Visible = True 'added line 5
strAddress = ActiveCell.Address 'added line 6
End If 'added line 7
Loop Until Not flgToggle
'Reset the pause active flag
flgPauseActive = False
'And return control to the calling routine
End Sub

Ken Johnson