Solved

How to set one column of an excel wrap text

Posted on 2011-03-06
7
867 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
  • 4
  • 2
7 Comments
 
LVL 50

Expert Comment

by:Ingeborg Hawighorst
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 earned 500 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Expert Comment

by:Ingeborg Hawighorst
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

Expert Comment

by:Ingeborg Hawighorst
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Batch file or script with password 22 44
Excel Drop Down List 13 34
Creating An Intelligent Dropdown 8 30
formatting - number format 2 14
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
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.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
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.

810 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