Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Toggle Macro
I'm having trouble learning Macros. I need to toggle a single cell (d33) between a value of 8% and blank.
ALSO, I'd love a better site for help topic. MS really dropped the ball on this topic. Thanks, Michael --- |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Toggle Macro
Michael,
Sub ToggleD33() If Range("D33").Value = "" Then Range("D33").Value = 0.08 Else Range("D33").ClearContents End If End Sub HTH, Bernie MS Excel MVP "Michael" wrote in message ... I'm having trouble learning Macros. I need to toggle a single cell (d33) between a value of 8% and blank. ALSO, I'd love a better site for help topic. MS really dropped the ball on this topic. Thanks, Michael --- |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Toggle Macro
Sub ToggleCell()
if isempty(Range("D33")) then Range("D33").value = .08 Range("D33").Numberformat = "0%" Else Range("D33").ClearContents End If End Sub -- Regards, Tom Ogilvy "Michael" wrote in message ... I'm having trouble learning Macros. I need to toggle a single cell (d33) between a value of 8% and blank. ALSO, I'd love a better site for help topic. MS really dropped the ball on this topic. Thanks, Michael --- |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Toggle Macro
Hi Michael
i would do it using: Sub togglevalue() If Sheets("Sheet1").Range("D33").Value = "" Then Sheets("Sheet1").Range("D33").Value = 0.08 Else Sheets("Sheet1").Range("D33").Value = "" End If End Sub and format the cell to percentage you can assign this code to a button / toolbar icon or shortcut key as you wish Hope this helps Cheers JulieD "Michael" wrote in message ... I'm having trouble learning Macros. I need to toggle a single cell (d33) between a value of 8% and blank. ALSO, I'd love a better site for help topic. MS really dropped the ball on this topic. Thanks, Michael --- |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Toggle Macro
Hi
see: http://www.mvps.org/dmcritchie/excel/getstarted.htm maybe something like sub foo() with activesheet.range("D33") if .value="" then .value = 0.08 else .value="" end if end with end sub -- Regards Frank Kabel Frankfurt, Germany Michael wrote: I'm having trouble learning Macros. I need to toggle a single cell (d33) between a value of 8% and blank. ALSO, I'd love a better site for help topic. MS really dropped the ball on this topic. Thanks, Michael --- |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Toggle Macro
Tom was the only one to give you the format as well, but the code
Range("D33").value = .08 Range("D33").Numberformat = "0%" can be combined with Range("D33").value = "8%" Excel does the rest. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Michael" wrote in message ... I'm having trouble learning Macros. I need to toggle a single cell (d33) between a value of 8% and blank. ALSO, I'd love a better site for help topic. MS really dropped the ball on this topic. Thanks, Michael --- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Toggle between two workbooks via MACRO | Excel Discussion (Misc queries) | |||
macro boxes: toggle on/off | Excel Discussion (Misc queries) | |||
Toggle comments on or off macro | Excel Discussion (Misc queries) | |||
workbook Protection Toggle Macro | Excel Discussion (Misc queries) | |||
Toggle Macro with KeyStrokes | Excel Programming |