ComboBox Keypress and transferring data from excel user form to sheet table

Kelvs

New Member
Joined
Aug 11, 2016
Messages
1
<body id="************" style="position: absolute; top: 0px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">

<tbody style="margin: 0px; padding: 0px; border: 0px;">
[TD="class: votecell"]
0down votefavorite
[/TD]
[TD="class: postcell"]I'm trying to create a small inventory system using excel, and I would like to use a macro to add a new record. My table and userform is in place, however, I have several issues.
First is that I'm unable to "lock" my comboboxes. I've tried locking it through its properties, however, the result is I'm now unable to select an item from the list. (The comboboxes are prepopulated). I have a button within my sheet (Add New Record) and it contains a code:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;"> UserForm1 . ComboBox1 . List = Array ( "HO" , "SI" , "SV" , "PTSF" )
UserForm1
. ComboBox2 . List = Array ( "AP" , "FU" , "GE" , "IT" )
UserForm1
. Show </code>And on my combobox:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;"> Private Sub ComboBox1_KeyPress ( ByVal KeyAscii As MSForms . ReturnInteger )
If KeyAscii = 8 Or KeyAscii = 127 Then
KeyAscii
= 0
Else
End If
end sub </code>The code on my combobox does not work, and what I would like to happen is to lock it so that nothing can be typed or edited.
Second problem is that I don't know how to call my table, and insert the data on my userform to it. I've tried this earlier:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;"> sheet1 . table1 . Lastrow = userform1 . textbox1 . value </code>but obviously it does not work :(
I hope someone can help me. Thanks in advance!


[/TD]

</tbody>
</body>

<tbody style="margin: 0px; padding: 0px; border: 0px;">
[TD="class: votecell"]
down votefavorite
[/TD]
[TD="class: postcell"]I'm trying to create a small inventory system using excel, and I would like to use a macro to add a new record. My table and userform is in place, however, I have several issues.
First is that I'm unable to "lock" my comboboxes. I've tried locking it through its properties, however, the result is I'm now unable to select an item from the list. (The comboboxes are prepopulated). I have a button within my sheet (Add New Record) and it contains a code:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;"> UserForm1 . ComboBox1 . List = Array ( "HO" , "SI" , "SV" , "PTSF" )
UserForm1
. ComboBox2 . List = Array ( "AP" , "FU" , "GE" , "IT" )
UserForm1
. Show </code>And on my combobox:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;"> Private Sub ComboBox1_KeyPress ( ByVal KeyAscii As MSForms . ReturnInteger )
If KeyAscii = 8 Or KeyAscii = 127 Then
KeyAscii
= 0
Else
End If
end sub </code>The code on my combobox does not work, and what I would like to happen is to lock it so that nothing can be typed or edited.
Second problem is that I don't know how to call my table, and insert the data on my userform to it. I've tried this earlier:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;"> sheet1 . table1 . Lastrow = userform1 . textbox1 . value </code>but obviously it does not work :(
I hope someone can help me. Thanks in advance!


[/TD]

</tbody>
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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