synergy16
Active Member
- Joined
- Mar 17, 2016
- Messages
- 422
- Office Version
- 365
- Platform
- Windows
good afternoon all.
i have a vba program that populates text/list boxes on a form, based on a users request in the form. it reads off a excel sheet that has delivery information for fedex shipments. the cells that contain the delivery "street address" are giving me an issue because they can contain a lot of text at times. so i have 2 text boxes for the address and what i want to do is if the text is over 20 characters long, stop at the first space BEFORE the text counter hit 20 and push the rest of the address (including the word that made the counter go over 20) to the second box. obviously i want to do this so words and/or numbers arent split in the middle. so what i have is>:
this will obviously only include the first 20 characters in the first textbox, but how do i also include the functionality i mentioned above?
i have a vba program that populates text/list boxes on a form, based on a users request in the form. it reads off a excel sheet that has delivery information for fedex shipments. the cells that contain the delivery "street address" are giving me an issue because they can contain a lot of text at times. so i have 2 text boxes for the address and what i want to do is if the text is over 20 characters long, stop at the first space BEFORE the text counter hit 20 and push the rest of the address (including the word that made the counter go over 20) to the second box. obviously i want to do this so words and/or numbers arent split in the middle. so what i have is>:
Code:
If Len(Cells(rowTr, 12)) > 20 ThenaddressTB.Text = Left(Cells(rowTr, 12), 20)
End If
this will obviously only include the first 20 characters in the first textbox, but how do i also include the functionality i mentioned above?