on cell enter..

P

paul

Hi, I'm using XL 2000

I need to load UserForm1 when a user makes a worksheet cell A1 active.

The Userform returns a value to the Active cell which is why i need the cell
entered to call the userform.

Any ideas appreciated.

Thanks, Paul
 
J

JE McGimpsey

One way:

Put this in your worksheet code module (right-click on the worksheet tab
and choose View Code):

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim myForm As UserForm1
If ActiveCell.Address(False, False) = "A1" Then
Set myForm = New UserForm1
myForm.Show
End If
End Sub
 
P

pikus

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Row = 1 And Target.Column = 1 Then
UserForm1.Show
End If
End Sub

- Piku
 
P

paul

The tip works fine.

Can I extend the active cell as a range.
For example A1:A50 ?

Thanks, Paul
 
J

JE McGimpsey

In that case I'd use something like:

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim myForm As UserForm1
With Target
If .Count > 1 Then Exit Sub
If Not Intersect(.Cells, Range("A1:A50) Is Nothing Then
Set myForm = New UserForm1
myForm.Show
End If
End With
End Sub
 
P

Paul

Perfect. Thank you.
-----Original Message-----
In that case I'd use something like:

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim myForm As UserForm1
With Target
If .Count > 1 Then Exit Sub
If Not Intersect(.Cells, Range("A1:A50) Is Nothing Then
Set myForm = New UserForm1
myForm.Show
End If
End With
End Sub





.
 
Top