?
Solved

How to set one column of an excel wrap text

Posted on 2011-03-06
7
Medium Priority
?
875 Views
Last Modified: 2012-05-11
Piece of VB script to set one column of excel to have wrap text feature.
0
Comment
Question by:srikanthv2322
[X]
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
  • 4
  • 2
7 Comments
 
LVL 50
ID: 35051573
Hello,

what exactly do you mean? The cell alignment to "Wrap" text inside a cell or do you want a column to flow into another column once it reaches a certain row?

please post an example of before and after as an Excel file.

cheers, teylyn
0
 
LVL 50

Accepted Solution

by:
Ingeborg Hawighorst (Microsoft MVP / EE MVE) earned 2000 total points
ID: 35051632
This macro will set the cell formatting to wrap text in column A

Sub WrapColumnA()
    Columns("A:A").WrapText = True
End Sub

Open in new window


The keystrokes required to start the macro are about the same as using the Excel format dialog.

cheers, teylyn
0
 

Author Comment

by:srikanthv2322
ID: 35051653
I just want to wrap the text in all the cells in the given column, would need a piece of vb code to implement the same
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:longtruong
ID: 35051712
Hello srikanthv2322,

You can use following code to enable wrap text feature on any column specified by nCol variable:

Sub WrapText()

    Dim nCol As Long
    nCol = 2
    Range(Cells(1, nCol), ActiveCell.End(xlDown)).WrapText = True

End Sub

Open in new window


I hope it helps.

Long
0
 
LVL 50
ID: 35051713
Your post and my suggestion crossed over. Will that work for you?
0
 
LVL 3

Expert Comment

by:longtruong
ID: 35051873
Hello Teylyn,

When I was composing my post, I thought I was the first person who participated in this thread.  However, you were quicker than I was and thus, I am happy to withdraw from this thread :-).

Regards,

Long
0
 
LVL 50
ID: 35053013
Long, LOL, my post 35051713 also crossed with your comment. I meant the asker, not you. Feel free to stick around. No worries.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

719 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