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

Formatting with Macros Excel 2003

Status
Not open for further replies.

captphan

Programmer
Jan 24, 2007
42
When ever I format using a Macro in Excel 2003, Excel crashes when I save the file. Has anyone else run into this and no of a work around.


I am glad I don't know it all because then I would be bored.
-Obie
 
What formatting are you doing? What kind of crash happens? Any messages?



Cheers, Glenn.

Beauty is in the eye of the beerholder.
 




Please post your code also. Might be more appropriate in Forum707.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I save succesffuly before
Code:
    Cells.Select
    Cells.EntireColumn.AutoFit


The only error message is
Micrsoft Office Excel has encountered a problem and needs to close. We are sorry for the inconvenience.



I am glad I don't know it all because then I would be bored.
-Obie
 



First of all, Cells on WHAT sheet?

Then, why select?

Better to do it this way.
Code:
   Sheets("TheSheetNameThatYouWantToAutoFit").EntireColumn.AutoFit


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 



oops
Code:
Sheets("TheSheetNameThatYouWantToAutoFit").Cells.EntireColumn.AutoFit

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Personally I would do an autofit on the entire sheet, just the UsedRange:
Code:
Sheets("TheSheetNameThatYouWantToAutoFit").UsedRange.EntireColumn.AutoFit

Cheers, Glenn.

Beauty is in the eye of the beerholder.
 
Read "would" as "wouldn't" .

Cheers, Glenn.

Beauty is in the eye of the beerholder.
 
Excellent thank You

I am glad I don't know it all because then I would be bored.
-Obie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top