#1   Report Post  
Posted to microsoft.public.excel.misc
Mark Olsen
 
Posts: n/a
Default Keep cell size

Hi, I am using VBA to query a database and then putting data into cells.
Some values have really long text in them and excel automatically turning on
wordwrap for some of them which results is very large cells in some places
which throws off the view of the worksheet. Is there any way to prevent
excel from doing this. i dont mind not being able to see all of the text.
Also, is there anyway to prevent excel from spilling long text into the next
column if the next column is blank? Thanks

Mark
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jim Rech
 
Posts: n/a
Default Keep cell size

You cannot change how Excel behaves but you can turn off word wrap after the
query. A macro can make this quick and easy.

Also, is there anyway to prevent excel from spilling long text into the
next column if the next column is blank?


Yes, leave on word wrap<g. Oh you want to eat your cake and have it too?
Well I'd leave word wrap on and then change the row height manually (or by
macro) to one line's height.

--
Jim
"Mark Olsen" wrote in message
...
| Hi, I am using VBA to query a database and then putting data into cells.
| Some values have really long text in them and excel automatically turning
on
| wordwrap for some of them which results is very large cells in some places
| which throws off the view of the worksheet. Is there any way to prevent
| excel from doing this. i dont mind not being able to see all of the text.
| Also, is there anyway to prevent excel from spilling long text into the
next
| column if the next column is blank? Thanks
|
| Mark


  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Keep cell size

Does your text have linefeeds in it, like:

ActiveCell.Value = "hello" & vbLf & "goodbye"

Excel turned on wordwrap when I did this.

And if you have wordwrap already toggled on, xl adjusted the rowheight.

One way to avoid either situations is to check (and save the rowheight's value),
then plop your data in and then adjust the rowheight back to what it was.

Excel will also refrain from adjusting rowheights if you've changed the row's
height (not by autofitting).

myHeight = ActiveCell.EntireRow.RowHeight
ActiveCell.Value _
= "hello goodbye hello goodbye hello goodbye hello goodbye"
ActiveCell.EntireRow.RowHeight = myHeight


And the only way I know that you can stop excel from filling the adjacent cell
with long text is to either turn wrap text on--or put something in that adjacent
cell.

I like to use a formula:
=""

I find it easier to see in the formula bar (than a space character) and it's
different enough to remind me why it's there.


Mark Olsen wrote:

Hi, I am using VBA to query a database and then putting data into cells.
Some values have really long text in them and excel automatically turning on
wordwrap for some of them which results is very large cells in some places
which throws off the view of the worksheet. Is there any way to prevent
excel from doing this. i dont mind not being able to see all of the text.
Also, is there anyway to prevent excel from spilling long text into the next
column if the next column is blank? Thanks

Mark


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
adjusting cell size in spreadsheets [email protected] Excel Discussion (Misc queries) 5 December 21st 05 05:59 PM
merged cells into one text cell, size varies dependant on text dat Jazzylady825 Excel Discussion (Misc queries) 0 December 9th 05 08:26 PM
Instead of a negative number, I'd like to show zero... Dr. Darrell Excel Worksheet Functions 6 December 7th 05 08:21 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM
Returning a Value to a Cell Based on a Range of Uncertain Size amc422 Excel Worksheet Functions 7 November 14th 04 03:03 PM


All times are GMT +1. The time now is 09:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"