Reputation: 13216
I'm currently inserting some values into an Excel spreadsheet via a VBA form. What I've done is working great so far but I was wondering if there was a way to set the text to automatically wrap in each cell?
As right now it seems like everything will just overlap with each other.
Private Sub btnSubmit_Click()
Dim ws As Worksheet
Dim rng1 As Range
Set ws = Worksheets("main")
Set rng1 = ws.Cells(Rows.Count, "a").End(xlUp)
rng1.Offset(1, 0) = cbo_deptCode.Value
End Sub
Upvotes: 0
Views: 5530
Reputation: 131
Try
With rng1.Offset(1, 0)
.Value = cbo_deptCode.Value
.WrapText = True
End With
Upvotes: 1