I'm trying to create a worksheet that will allow for minimal user input (mouse clicks and keyboard interaction). I have cobbled together the start of what I need based on what I've already found in the forum. The first is to enter a time stamp into a cell (within a range in column A) when it's double-clicked, then move to the adjacent cell in column B. In the cells in column B I have a data validation list. So the second thing I want to happen is to automatically expand the drop down list in the column B cell so my user can simply select a choice that's shown. And then the third and final thing I'm wanting to happen is that after the selection is made for column B I want the cell selection to move to the right again, to the adjacent cell in column C.
So this for example... user double-clicks A2 and the time is entered, then B2 is automatically selected and shows a data validation drop down list, the user selects a choice, and then is automatically taken to C2.
I was able to get the date in column A and then move to column B using this code.
And I was able to make my data validation drop down list appear when I "manually" selected a specified cell by clicking on it by using this code.
Since I don't want manually select a cell (by clicking it) I figured I could plug the "SendKeys" line under the ".Offset(0, 1).Activate" line in the time stamp code. When I test it I think I can see the drop down list flash on the screen, but it doesn't stay so the selection can be made. Any thoughts on how to fix this? Or is there a more efficient way to accomplish this? Thanks!
So this for example... user double-clicks A2 and the time is entered, then B2 is automatically selected and shows a data validation drop down list, the user selects a choice, and then is automatically taken to C2.
I was able to get the date in column A and then move to column B using this code.
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
On Error Resume Next
Dim rng As Range
Set rng = Range("TimeEntry")
If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, rng) Is Nothing Then
With Target
.Value = Time
.Offset(0, 1).Activate
End With
End If
End Sub
And I was able to make my data validation drop down list appear when I "manually" selected a specified cell by clicking on it by using this code.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo Err1:
If Target = Range("B10") Then
Application.SendKeys ("%{UP}")
End If
Err1:
do nothing
End Sub
Since I don't want manually select a cell (by clicking it) I figured I could plug the "SendKeys" line under the ".Offset(0, 1).Activate" line in the time stamp code. When I test it I think I can see the drop down list flash on the screen, but it doesn't stay so the selection can be made. Any thoughts on how to fix this? Or is there a more efficient way to accomplish this? Thanks!