Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 97 hide and no print certain cells?

Status
Not open for further replies.

Maine

Technical User
Feb 4, 2001
41
US
In Excel 97, I have a worksheet on which there are several cells containing data that I need to hide at certain times and not print when hidden. Unfortunately they are not all in one column, so I can't hide the entire column. I tried adding a button which changes the color of the type in the cell to white - which worked except that it still prints! Is there an easy way to hide and not print certain cell's data? Any help would be greatly appreciated.
 
Select the cells that contain the values you want to hide.

On the Format menu, click Cells, and then click the Number tab.

In the Category list, click Custom.

In the Type box, select the existing codes and press BACKSPACE.

In the Type box, type ;;;

The hidden values appear only in the formula bar — or in the cell if you edit within the cell — and are not printed.

To display hidden values again, select the cells, click the Cells command on the Format menu, and then click the Number tab. In the Category list, click General to apply the default number format. To redisplay a date, a time, or values that have a specific number format, select the appropriate date, time, or number format on the Number tab.

(|:)>
 
Is it possible to add this as a macro to a command button to automate the process? The file is used by many salespeople and they are not all computer literate - the easier the better when they are concerned. Your help is very much appreciated.
 
Why do the cells still print when colored white?
Is there some type of background color within the cell?

If there is a color background, set the font color the same as the background to hide the cell.

I like LRH's suggestion. Never hear that one before, works great!
 
I tried setting the background color to the same and it still printed. I'll try LRH's solution but would really like to assign it to a button. Any help would be appreciated. Thanks much to all.
 
If you place this code as your macro it should work as you wish.

Selection.NumberFormat = ";;;"

I prefer to assign macro's to objects within the file and not to the Toolbars.
 
I'm having to use a second button to cancel the 'hide'... using the format of what's been hidden, e.g.

Selection.NumberFormat = "0000,00"

LRH
 
The button works! Thank you, thank you, thank you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top