Mikeymike_W
Board Regular
- Joined
- Feb 25, 2016
- Messages
- 171
Hi,
I am wanting to copy the text from a Userform Textbox (TBRand) to another textbox (TBRandB) on the same userform.
The thing is I only want to copy over the text that occurs before the hyphon (-).
I found this bit of code which does it for a worksheet but i'm not sure how to adapt this for a userform textbox.
I appreciate any help you can give me,
Mike
I am wanting to copy the text from a Userform Textbox (TBRand) to another textbox (TBRandB) on the same userform.
The thing is I only want to copy over the text that occurs before the hyphon (-).
I found this bit of code which does it for a worksheet but i'm not sure how to adapt this for a userform textbox.
I appreciate any help you can give me,
Mike
VBA Code:
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
ws.Range("C5") = Left(ws.Range("B5"), (Application.WorksheetFunction.Find("-", ws.Range("B5"), 1) - 1))