LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 123
Default Macro for Shading and Unshading

I have the following 2 macros as buttons on a custom toobar to Shade or
Unshade cells.

Sub Shade_Cell()
'
' Shade_Cell Macro
'
ActiveSheet.unprotect Password:="paspas"
With Selection.Interior
.ColorIndex = 35
.Pattern = xlSolid
ActiveSheet.Protect Password:="paspas", DrawingObjects:=True,
Contents:=True, Scenarios:=True, AllowInsertingRows:=False,
AllowDeletingRows:=False
End With
End Sub


Sub unshade()
'
' unshade Macro

ActiveSheet.unprotect Password:="paspas"
Selection.Interior.ColorIndex = xlNone
ActiveSheet.Protect Password:="paspas", DrawingObjects:=True,
Contents:=True, Scenarios:=True, AllowInsertingRows:=False,
AllowDeletingRows:=False
End Sub

Is there anyway to merge these two macros to one button on my custom
toolbar. So if the range highlighted is already shaded this color (35) then
unshade....if it has no shade then change it to 35.
thanks in advance for any help.
tami


 
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
Macro for shading Atomic Excel Worksheet Functions 5 June 3rd 08 06:32 PM
Creating a Macro For Shading Rows - Or Should I Use Conditional Formatting? [email protected] Excel Worksheet Functions 3 May 3rd 07 11:41 PM
shading a rowwhen a time is entered but no shading when 0 is enter fomula problems Excel Worksheet Functions 7 October 23rd 05 08:44 PM
Shading cells with a Macro maacmaac Excel Discussion (Misc queries) 1 August 18th 05 03:48 PM
Is there a formula, function or macro that accounts for shading of a cell or row? Jamie Furlong Excel Discussion (Misc queries) 1 August 12th 05 09:55 AM


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

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

About Us

"It's about Microsoft Excel"