UsedRange & Formatting of Cells

J

JStone0218

When I use the code below, the shading of the cells in column A impact the
UsedRange. Is this normal?

For Each cell In ActiveSheet.UsedRange.Columns(1).Rows
 
R

Robert Rosenberg

Accidentally hit Ctrl+Enter and sent my other response prematurely.

You can refine your code as follows:

For Each cell In
ActiveSheet.UsedRange.Columns(1).SpecialCells(xlCellTypeConstants).Rows.Addr
ess

This assumes that column 1 has constant and not formulas. If they contain
formulas, use xlCellTypeFormulas. If they contain both, you'll need to use a
range variable and define it for both using "Union".
 
J

JStone0218

Robert,

Thanks for the quick response. I followed your recomendation and it works
great!

James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top