Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 881
  • Last Modified:

How to set one column of an excel wrap text

Piece of VB script to set one column of excel to have wrap text feature.
0
srikanthv2322
Asked:
srikanthv2322
  • 4
  • 2
1 Solution
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
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
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
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
 
srikanthv2322Author Commented:
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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

 
longtruongCommented:
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
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
Your post and my suggestion crossed over. Will that work for you?
0
 
longtruongCommented:
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
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
Long, LOL, my post 35051713 also crossed with your comment. I meant the asker, not you. Feel free to stick around. No worries.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

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.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now