Wrap not working

K

Karen53

Hi,

I am placing information to a worksheet via vba code and the wrap is not
working. How do I correct this? Here is my code:

Sub SaveTenantName(Choice)

With MainPagepg

'save Tenants Name
With .Cells(Choice, 6)
.NumberFormat = "General"
.HorizontalAlignment = xlLeft
.WrapText = True
.Value = frmStoreData.txtTenantName.Value
End With

End With

End Sub
 
K

Karen53

I realize now the wrap is there but the row height is not adjusting to show
the text.
 
K

Karen53

Hi,

I've added row autofit but it still is not sizing. What am I doing wrong?

Sub SaveTenantName(Choice)

With MainPagepg

'save Tenants Name
With .Cells(Choice, 6)
.NumberFormat = "General"
.HorizontalAlignment = xlLeft
.WrapText = True
.Value = frmStoreData.txtTenantName.Value
End With
.Rows(Choice & ":" & Choice).EntireRow.AutoFit
End With

End Sub
 
J

Joel

Try this change
from:
With MainPagepg
to:
With sheets(MainPagepg)

or

With sheets("MainPagepg")
 
K

Karen53

Hi,

Thank you for your suggestions. I'm using the sheets code name, though.
They did not work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top