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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Being Sure Of Having all cells expanded

Status
Not open for further replies.

HLEE1167

Programmer
Mar 21, 2006
17
US
I need to be sure that all my cells expands and that I do not have any ##### because of a number being too big for its cell. Do you have an idea of how to do this? I had tried changing the font to Times New Roman Programatically but it do not solve the problem

Thank you
 
The best way to find things like this out is to record a macro of yourself doing this then look at the code behind.

Something like this may help you:
Code:
Cells.Select
    Cells.EntireColumn.AutoFit
Hope this helps

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Thank you for the reply. I am using similar code but I still get several cells with ###### instead of the real content. Do anyone know Why this happend and how it could be solved.

Thank you
 
HLEE1167,

What is your code anyway? And what data which is not shown?

vladk
 
probably negative times....

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
First of all, to address the little pet peeve of mine ...

STOP SELECTING CELLS VIA CODE!!

;)

Code:
Sheets("Sheet1").Cells.EntireColumn.Autofit

Second, Geoff is right, because that is the ONLY other reason you'll have ###### in a cell (unless some smart a$$ has typed them in there manually - oh, don't laugh, I've seen it...).

-----------
Regards,
Zack Barresse
 
LOL - just to second that - basically, any time you have 2 selectes in a row, you can get rid of both of 'em - it's kinda like quadratic equations.....(yeh - I know - that statement makes me a geek ;-) )

Cells.Select
Selection.Do_stuff

can, 99.9% of the time be replaced with

Cells.Do_Stuff

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Wow, Geoff, major geek. ;)

-----------
Regards,
Zack Barresse
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top