Solved

Typing in a cell as opposed to any other way a textbox can get its value

Posted on 2013-11-25
4
201 Views
Last Modified: 2013-11-26
Excel 2010
vba
useform and textbox

I need to know if there a way to capture distinctly if a person is actually typing a value in a textbox on a userform as opposed to ANY other way a textbox can get it value?



Thanks
fordraiders
0
Comment
Question by:fordraiders
  • 2
  • 2
4 Comments
 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 39676301
You can probably do this.

Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If (KeyCode = 17 And Shift = 2) Or (KeyCode = 86 And Shift = 2) Then
    ' copying or pasting
Else
    MsgBox "Manual update"
End If
End Sub

Open in new window

0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 39676720
Thanks...
0
 
LVL 3

Author Comment

by:fordraiders
ID: 39676721
forget to ask...  cut and paste ?
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39677852
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

If (KeyCode = 17 And Shift = 2) Or _
   (KeyCode = 86 And Shift = 2) Or _
   (KeyCode = 88 And Shift = 2) Then
    ' copying or pasting
Else
    MsgBox "Manual update"
End If
End Sub

Open in new window

You're welcome and I'm glad I was able to help.

Marty - MVP 2009 to 2013
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

Suggested Solutions

Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

920 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

16 Experts available now in Live!

Get 1:1 Help Now