?
Solved

Copy Combo box value to cell in Excel sheet

Posted on 2010-08-19
2
Medium Priority
?
992 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
kooswillem earned 1000 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

771 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