We help IT Professionals succeed at work.

Excel VBA Grey area where cells are unused

Murray Brown
Murray Brown asked

I have a client spreadsheet where unused cells to the right are automatically grey. What causes this and how would I set up and additional sheet to act like this?


Watch Question

Darrell PorterEnterprise Business Process Architect

Did you check the Conditional Formatting rules?
If you place data in one of these cells is it no longer grey?
Analyst Assistant
It looks like columns K to the last column in the sheet have been hidden.

To do so manually:

1 Select column K

2 Hold down SHIFT, hit END and then the right arrow key.

3 Right click in the highlighted area and select Hide.


Range("K1", Cells(1, Columns.Count)).EntireColumn.Hidden = True

Open in new window

Murray BrownASP.net/VBA/VSTO Developer


Thanks very much
Rob HensonFinance Analyst

If columns were hidden you wouldn't see the headers for those columns.

The sheet is in Page Break Preview mode. The Blue line indicates the Print Area.

On the View tab there are numerous options on the left hand end.
Normal - usual view with row and column headers, page break show as dotted line on the grid
Page Break Preview - Outside of the Print Area is greyed out, the page breaks show as blue lines, dotted for an automatic break, solid for a manual break. The blue lines can be dragged around to change the page breaks
Page Layout - Like a Print Preview, showing headers and footers etc.