Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro Boxes
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. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro Boxes
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" wrote: 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. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro Boxes
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 On Wed, 3 Oct 2007 16:01:00 -0700, Peter wrote: 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. |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro Boxes
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. "Gord Dibben" wrote: 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 On Wed, 3 Oct 2007 16:01:00 -0700, Peter wrote: 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. |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro Boxes
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 On Thu, 4 Oct 2007 09:39:00 -0700, Peter wrote: 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. "Gord Dibben" wrote: 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 On Wed, 3 Oct 2007 16:01:00 -0700, Peter wrote: 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro that can run combo boxes | Excel Discussion (Misc queries) | |||
Macro to clear contents of unprotected cells AND drop down boxes | Excel Discussion (Misc queries) | |||
How do I get the macro tool boxes to display? | New Users to Excel | |||
How clear the cut/copy blinking boxes after macro | Excel Worksheet Functions | |||
How do I create a macro to return drop down boxes to first item i. | Excel Discussion (Misc queries) |