ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro Boxes (https://www.excelbanter.com/excel-discussion-misc-queries/160869-macro-boxes.html)

Peter

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.






All times are GMT +1. The time now is 03:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com