Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Toggle between two workbooks via MACRO Aligi Excel Discussion (Misc queries) 2 July 8th 08 08:43 PM
macro boxes: toggle on/off Peter Excel Discussion (Misc queries) 1 October 5th 07 09:34 AM
Toggle comments on or off macro Jim G Excel Discussion (Misc queries) 3 October 5th 06 04:07 AM
workbook Protection Toggle Macro Just Learning Excel Discussion (Misc queries) 3 August 30th 05 11:03 PM
Toggle Macro with KeyStrokes Cesar Zapata[_2_] Excel Programming 0 November 13th 03 05:07 PM


All times are GMT +1. The time now is 04:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"