VBA Userform : Add value to textbox based on Mouse cursor
Hi Friends,
https://cdn1.imggmi.com/uploads/2019...21675-full.jpg
This is my Userform. When ever i press the mathematical buttons values will come in the last of textbox (refer the image). I want VBA code where these values will come where the cursor is in the textbox.
Example : I want "+" in between "(" and ")" . So basically i will add the curson between this and press the "+" button. But the values are coming in the last of this textbox.
Someone please help me .
Note : Refer the screenshot
Thanks
Re: VBA Userform : Add value to textbox based on Mouse cursor
I don't see an image, perhaps because my work is filtering out images.
I also don't see your code.
But it sounds like you just need to use the SelText property, to put the text in at the cursor position (or in place of selected text if any is selected).
Code:
Private Sub Command1_Click()
Text1.SelText = "+"
End Sub
Re: VBA Userform : Add value to textbox based on Mouse cursor
WoW. Thanks alot.
I was using Text1.Text instead of Text1.SelText .