Maintaining Macros on a sheet when it is saved as a new workbook

T

Tony Bender

I have an application where via one macro the user can double-click on
a specific cell and it pops up a TextBox with a definition. Then they
can click on the TextBox to close it.

Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
'displays definition with a live example
If ActiveCell.Address = "$B$3" Then
Cancel = True
With ActiveSheet
.Shapes("Group1").Visible = True
End With

ElseIf ActiveCell.Address = "$J$3" Then
Cancel = True
With ActiveSheet
.Shapes("Group4").Visible = True
End With

End If
End Sub


Then through a separate macro the user can click on the TextBox to
close it.

Sub CloseTB1()
With ActiveSheet
.Shapes("Group1").Visible = False
End With
End Sub

These both reside on a sheet-tab named "Report".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top