Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi OssieMac, Thanks for your response. I was afraid that was the answer. The problem is I don't know what the size is going to be. But it is what it is, I'm thinking I'll just write it to set the columnwidth based on the size of the string of one list item. As far as the row height code, yeah I know it's ugly... it's really obviously ugly if Excel is visible while it's doing it. It's that way because I could never find the right syntax to do it all at once, everything I tried (this was some time ago, as I'm reusing code) resulted in some error except the way that's shown. So! Thank you for the code, I'll use it! Thanks for your help, OssieMac. Ken "OssieMac" wrote: Hi Ken, You have basically answered your own question. "if you enlarge the column width larger than a single item in the list, then it wraps at the vbLf". Simply set the column width larger than what can be expected and then apply AutoFit. Even in the interactive mode you have to widen the column and then apply AutoFit or it adjusts to the widest existing data in the cells and tends to ignore linefeeds. Auto column width adjusts to the max width of the data in the cells as it exists prior to the AutoFit. A little constructive criticism on your other code. Why loop trough the used range to adjust the height. You can simply apply Autofit to the entire used range. objSheet.UsedRange.Rows.AutoFit 'or following With objSheet.UsedRange .Rows.AutoFit .Columns.AutoFit '(If required.) End With -- Regards, OssieMac |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA inserting chr(10) or vbLf | Excel Discussion (Misc queries) | |||
autofit problem | Excel Programming | |||
Range WrapText and AutoFit with Bold | Excel Programming | |||
vblf and vbcr one last question | Excel Programming | |||
autofit row problem | Excel Discussion (Misc queries) |