# Word Wrap VBA to Specific Column Width

#### vahnx

##### Board Regular
I have a database in excel, here's some sample data.

When they click the print button in Cell A2, up comes my form

When the print tags button is pressed, my secondary sheet is populated with the cell they clicked on

Now it's using a font, calibri 11, which isn't proportional but I was wondering if there's a way in VBA to "auto" detect the max width and place words on the next row accordingly (like a word wrap). Here's what I need it to look like:

Here's my existing code to place the comments as is:

Code:
``````                entireComment = "Comments: " & Range("P" & i)
.Range("A" & cnt + 11).Value = Mid(entireComment, 1, 33)
If Len(entireComment) >= 36 Then
.Range("A" & cnt + 12).Value = Mid(entireComment, 36, 35)
End If
If Len(entireComment) >= 71 Then
.Range("A" & cnt + 13).Value = Mid(entireComment, 72, 35)
End If
If Len(entireComment) >= 106 Then
.Range("A" & cnt + 14).Value = Mid(entireComment, 107, 35)
End If
If Len(entireComment) >= 141 Then
.Range("A" & cnt + 15).Value = Mid(entireComment, 142, 35)
End If
If Len(entireComment) >= 176 Then
.Range("A" & cnt + 16).Value = Mid(entireComment, 177, 35)
End If
If Len(entireComment) >= 211 Then
.Range("A" & cnt + 17).Value = Mid(entireComment, 212, 35)
End If``````

This is one of the last hurdles in a project I'm working on.

### Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

#### JLGWhiz

##### Well-known Member
This is out of the VBA help file, but you can probably figure out how to use it.

Code:
<CODE>Worksheets("Sheet1").Range("B2").Value = _
"This text should wrap in a cell."
Worksheets("Sheet1").Range("B2").WrapText = True
Code:
</CODE>

#### vahnx

##### Board Regular
Thank you so much! Much simpler solution than what I attempted.

#### JLGWhiz

##### Well-known Member
Thank you so much! Much simpler solution than what I attempted.

The VBA help files are not that easy to use if you are not familiar with the conventions and VBA language. But the more they are used the easier it gets.

Regards, JLG

Replies
2
Views
122
Replies
6
Views
271
Replies
11
Views
499
Replies
1
Views
79
Replies
2
Views
451

1,127,572
Messages
5,625,584
Members
416,119
Latest member
JCLLE

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back