Excel User Form using VBA

sachinns

Board Regular
Joined
Jun 21, 2019
Messages
52
Hi Folks,

I am very new to VBA as well as this forums . So i need your support.

1. Need code for deleting the values in the textbox using keyboard (like using delete/backspace on the keyboard)
- Deleting values like last words , not by single single alphabets. Eg : if the textbox contains ( Number of poles ) , when i press backspace 'poles' should be removed not the 's' )
2. I want to add values of a button to a textbox where ever the cursor is there , In my code the values will be added to the last of the textbox always.

CODE:

Private Sub Addition_Click()
If TextBox2.Text = "" Then
TextBox2.Text = " + "
Else
TextBox2.Text = TextBox2.Text + " + "
End If
End Sub



Please help me guys.
Thanks in advance.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Re: Excel User Form using VBA : Help Needed

I know of no script which will run when you hit backspace Key.
You said:
Need code for deleting the values in the textbox using keyboard (like using delete/backspace on the keyboard)

Please explain more about your ultimate Goal and not how to do it.

You also said:
I want to add values of a button to a textbox

So are you saying your button caption is a number like 12

 
Upvote 0
Re: Excel User Form using VBA : Help Needed

Hi,

Ujhhq.jpg


This is user form look like. When i press the buttons like +,-,* . It will come to formula Description. So if User enters wrong data they want to remove it using backspace or delete button in keyboard.

Also, if user keep the cursor anywhere in the Formula Description and then press the buttons like +,-,/ . Value should come in that cursor position not the last of that textbox.

I hope now it is clear for you.

Thanks
 
Upvote 0
Re: Excel User Form using VBA : Help Needed

Yes I understand more now.
I know of no way to enter value where cursor is positioned.

I believe your saying if Description Says:

Peter is my friend.

You want to position cursor after my and then when you click on a button you want to enter Good just after My

This is beyond my knowledgebase.
I will continue to monitor this thread to see what I can learn.
 
Last edited:
Upvote 0
Re: Excel User Form using VBA : Help Needed

Yeah Exactly.

I need 2 help. One is this which you told and another one is that , Taking your example.

If the Description says "Peter is my friend" . If i press the backspace key or Delete button in my keyboard , it should delete friend from the description and if i press again the space should deleted and if i press again it should delete my and so on.
Do you how to do this one.

Thank you
 
Upvote 0

Forum statistics

Threads
1,213,485
Messages
6,113,931
Members
448,533
Latest member
thietbibeboiwasaco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top