Solved

Copy Combo box value to cell in Excel sheet

Posted on 2010-08-19
2
964 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

914 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now