PDA

View Full Version : OPEN DATA FORM



sivadnitram
11-02-2008, 09:04 AM
I am trying to find a method of opening a data form when I select an empty cell instead of having to go to menu data/form. Have attempted to create a macro to open a data form but once I go through the sequenece I require whilst in Macro Record Mode I am unable to stop the Macro recording once i have opened the Data/Form. I was going to trigger this macro on cell selection. I am using Excel 2003. Any help greatly appreciated.

Bob Phillips
11-02-2008, 09:55 AM
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "A:A" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then

With Target

If .Row > 1 And .Offset(-1, 0).Value <> "" Then

Me.ShowDataForm
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub


This is worksheet event code, which means that it needs to be
placed in the appropriate worksheet code module, not a standard
code module. To do this, right-click on the sheet tab, select
the View Code option from the menu, and paste the code in.