LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default macro to white out (to change a font in selected cells)

Right click on the sheet tab containing the button and select View Code

In the resulting module, at the top, in the left dropdown, select
CommandButton9
in the right dropdown select click

make it look like this

Private Sub CommandButton9()
ActiveCell.Activate
Dim rng As Range
Set rng = Sheets("Option").Range("B26:E44")
If rng(1).Font.ColorIndex < 2 Then
rng.Font.ColorIndex = 2
rng.Borders.ColorIndex = xlNone
Else
rng.Font.ColorIndex = xlAutomatic
rng.Borders.ColorIndex = xlAutomatic
End If
End Sub


Then go back to your worksheet. Make sure you are not in design mode (if
you click the button and it gets selected, then you are in design mode. In
the control toolbox toolbar the top left button would then appear depressed.
Click it so it does not appear depressed).

So clicking the button should toggle back and forth between showing the text
and not showing the text.
--
Regards,
Tom Ogilvy


"Abi" wrote in message
...
I'm not sure how I apply this to my button. I have CommandButton9 to use

for
this, but I don't know how to get it to function with click()

????? sorry! I'm a bit thick today, I guess!


"Tom Ogilvy" wrote:

I will assume all the cells in that range have borders around them:

Sub SwitchColor()
Dim rng As Range
Set rng = Sheets("Option").Range("B26:E44")
If rng(1).Font.ColorIndex < 2 Then
rng.Font.ColorIndex = 2
rng.Borders.ColorIndex = xlNone
Else
rng.Font.ColorIndex = xlAutomatic
rng.Borders.ColorIndex = xlAutomatic
End If
End Sub

--
Regards,
Tom Ogilvy


"Abi" wrote in message
...
I definitely want to remove and add the borders. I've been looking at

the
"Borders" command in the help files, but can't seem to get how it

functions.

"Tom Ogilvy" wrote:

Just use 1 button:

Sub SwitchColor()
Dim rng As Range
Set rng = Sheets("Option").Range("B26:E44")
If rng(1).Font.ColorIndex < 2 Then
rng.Font.ColorIndex = 2
Else
rng.Font.ColorIndex = xlAutomatic
End If
End Sub

If you really want to process the borders, post back.

--
Regards,
Tom Ogilvy


"Abi" wrote in message
...
On my form on the first sheet of the workbook, I want to put a

button
that,
when clicked, will change the formatting on another sheet (a

selection
of
cells, actually) from the generic font to white - basically

blanking
it
out
from the page.

I also want another button to add that information back in.

I played around in a blank sheet and was able to change the font

color
of
cell text, but when I tried to apply it to my actual form, it

doesn't
work.

Here's what I recorded:
Sheets("Option").Select
Range("B26:E44").Select
Selection.Font.ColorIndex = 4
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone

"Options" contains the information I want to white out, if

necessary.
The
button is placed on another sheet called "Enter Info."










 
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
White font prints Teddy-B Excel Discussion (Misc queries) 1 October 22nd 08 04:08 PM
I downloaded a template but the font is white and I can't change i jr Excel Discussion (Misc queries) 3 August 3rd 08 06:25 PM
I downloaded a template but the font is white and I can't change i jr Excel Discussion (Misc queries) 0 August 3rd 08 05:16 PM
white font in certain cells Jon Excel Discussion (Misc queries) 5 November 4th 05 11:28 PM
change display font to actual selected font Flannigan Excel Discussion (Misc queries) 1 August 30th 05 01:46 PM


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

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"