Solved

Copy Combo box value to cell in Excel sheet

Posted on 2010-08-19
2
969 Views
Last Modified: 2012-05-10
I have a combo box in a UserForm. How can I copy the value that I pick in the combo box  into a certain cell on Excel sheet? I found something similar. However, how can I do it without pressing enter as there will not be any keyboard available when the program is put on a touchscreen monitor.
Private Sub TextBox2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger)

    If KeyCode = 13 Then
      Worksheets("GUI").Cells(25, 3) = TextBox2
    End If

End Sub

Open in new window

0
Comment
Question by:teeling
2 Comments
 
LVL 3

Accepted Solution

by:
kooswillem earned 250 total points
ID: 33482632
So why not just use "Worksheets("GUI").Cells(25, 3) = TextBox2"?

The "If statement with KeyCode = 13" is the "is the enter key pressed" condition.
0
 
LVL 3

Expert Comment

by:dockhand
ID: 33482924
VB.NET does not support default properties in the same manner as VB6 so I think that you will want to change TextBox2 to TextBox2.Text.  Also seeing as you were checking for the enter key you might want to move this loigc to the Validated Event instead of checking on every key stroke.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question