Description
I am experimenting with mouse-rollover events. On a sheet I have the following layout:
In column A, there are 3 named ranges: RegionOne which is A2:A4 RegionTwo which is A5:A7 and RegionThree which is A8:A10. These Range Names are listed in C1:C3. In D1:D3 I have the following formula:
=IFERROR(HYPERLINK(ChangeValidation(C1)),"RegionOne") (C1 changes to C2, C3 in D2, D3)
Cell F1 is a named range: NameRollover. Cell F2 is a Data Validation cell where Allow: = source that changes according to code execution.
Purpose
When a user rolls the mouse over the range D1:D3 the following happens:
- The cell is highlighted according to a Conditional Format
- Cell
F1(NameRollover) changes to the highlighted cell content - Cell
F2Data Validation changes the source to the Named Range that matches the value in CellF1 - Cell
F2is populated with the first entry of the data validation list
This is achieved by using the following Private Sub on Sheet1:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyList As String
If Not Intersect(Range("F1"), Target) Is Nothing Then
With Sheet1.Range("F2")
.ClearContents
.Validation.Delete
MyList = Sheet1.Range("F1").Value
.Validation.Add Type:=xlValidateList, Formula1:="=" & MyList
End With
Sheet1.Range("F2").Value = Sheet1.Range(MyList).Cells(1, 1).Value
End If
End Sub
And by using the following Function (in a standard module)
Public Function ChangeValidation(Name As Range)
Range("NameRollover") = Name.Value
End Function
Everything works perfectly, except…
I would like, after the rollover action, for the data validation cell (F2) to become the “active” cell. At the moment, the user has to select that cell unless it already is the active cell. To try and achieve this, I have tried each of the following at the end of the Private Sub before the End If:
Application.Goto Sheet1.Range("F2")
Sheet1.Range("F2").Select
Sheet1.Range("F2").Activate
None of which works.
Question
How can I get the focus to shift at the end of the Private Sub execution to the cell of my choice – in this case F2? All suggestions are welcome.


