Solved

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

Posted on 2013-11-25
4
198 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 45

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 45

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
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 how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

757 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

18 Experts available now in Live!

Get 1:1 Help Now