Macro Boxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, I created a box and inserted a macro. Now I can click on the box to
run the macro but it won't turn off when I click it again. How can I "Un-run"
the macro by clicking on the box a second time?

Thanks.
 
hi,
I don't think you can "un-run" an macro. once started a macro runs until it
hits end sub. also macro by-passes all the built in un-do's so once a macro
has run, there are no un-do buttons. if you want to stop a macro before it
completes, try ctrl+break. that is the emergency stop buttons. real good when
you have inadvertenly gotten yourself into a run away loop.

Regards
FSt1
 
Peter

Do you want a toggle on/off macro?

Sample.................

Sub Wrap_Text()
With Selection
.WrapText = Not .WrapText
End With
End Sub

Click once to set wrap text on. Click again to turn off.

I think you posted earlier and got code to color some cells.

Post that code and we'll have a look at toggling.


Gord Dibben MS Excel MVP
 
Here is the code that was used to create the color cell macro:

Sub auditt()
Dim sh1 As Worksheet, sh2 As Worksheet
Set sh1 = Sheets("12 Original")
Set sh2 = Sheets("12 Final")
For Each r In sh1.UsedRange
v1 = r.Value
rr = r.Row
cc = r.Column
v2 = sh2.Cells(rr, cc).Value
If v1 <> v2 Then
sh2.Cells(rr, cc).Interior.ColorIndex = 36
End If
Next

End Sub

It would be great if we could toggle this to make it turn on/off by pressing
the button.

Thanks.
 
Peter

I will have to work on this. My VBA skills are not great.

Hopefully one of the real experts will come along to help us.


Gord
 
Back
Top