Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Excel: Hide extended content with VBA

Posted on 2011-09-13
Last Modified: 2012-05-12
Hello, i'm using selection.value to write value in a cell.
The problem is the value is very long so it display over the next cells

as you can see on attached. But its strange that CELL E2 which also fill with long content can keep the extended content hidden.

how to solve this problem ?

Question by:veematics

Accepted Solution

ragnarok89 earned 350 total points
ID: 36530328
Cell contents will overflow to the right if the cell on the right is blank. I can think of 3 fixes for this:

1. Right click cell, > Alignment > Wrap text
2. add a "space" to each of your blank cells
3. use merged cells to the right. text never flows over to a merged cell


Expert Comment

ID: 36530334
Excel only hides the extended text in a cell when the adjacent cell has a value in it. See in F2, there is a value written. Write some values in F3, F4, and F5 and see if that doesn't hide the extended content. Otherwise, you could also simply make the column wider. That  may or may not be practical for you, though.

Author Comment

ID: 36530385
@ragnarok89 , Right click cell, > Alignment > Wrap text <- can we do that with scripts (vba)
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Expert Comment

ID: 36530506
Yes. I think it goes:

RangeObject.Font.WrapText = True [or False]

Assisted Solution

SafetyFish earned 150 total points
ID: 36530572
My bad, no need to put Font in there. It seems to work best as simply:

RangeObject.WrapText = True

Expert Comment

ID: 36530644
This is just a cheating way of doing it -

You can hide that column, then insert a column that contains the summary of the hidden column.

1) Insert new column F (note this may change your macro references)
2) Starting at row 2 use the formula =LEFT(E2,10) change the #10 as needed
3) copy down as needed
4) hide column E

Hope this helps


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question