In Excel97, I want a Calendar to pop-up when the user clicks on a cell in specific cell ranges. The user should only be able to enter dates chosen from the Calendar into the cell.
At the moment, I am using the following code. Form1 has the Calendar control on it. What this code does is that when an Active Cell is within the specified range, then when the user presses a shortcut, it runs the macro to pop-up the Calendar. This works fine, but I'd like the Calendar to pop-up when the user simply highlights a cell (makes a cell Active) in the specified ranges.
Thanks,
DocNash
Sub auto_open()
Dim KeyCells As String
KeyCells = "D3:D1000, E3:E1000, H3:H1000, J3:J1000, K3:K1000"
If Not Application.Intersect(ActiveCell, Range(KeyCells)) Is Nothing Then DoIt
End Sub
You need to place your code presently in auto_open() in the Worksheet_SelectionChange() event.
Replacing "ActiveCell" with "Target", thus:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim KeyCells As String
KeyCells = "D3:D1000, E3:E1000, H3:H1000, J3:J1000, K3:K1000"
If Not Application.Intersect(Target, Range(KeyCells)) Is Nothing Then DoIt
You need to place your code presently in auto_open() in the Worksheet_SelectionChange(
Replacing "ActiveCell" with "Target", thus:
Private Sub Worksheet_SelectionChange(
Dim KeyCells As String
KeyCells = "D3:D1000, E3:E1000, H3:H1000, J3:J1000, K3:K1000"
If Not Application.Intersect(Targ
End Sub
BFN,
fp.