MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Onevent action when data entered in colum A


Posted by keithkemble on February 12, 2002 12:58 PM

I have written a macro which is meant to activate when data is entereed into a blank cell in colum A.

This fuction when activated will run the routine , even if I click with the mouse on the cell.

I have followed examples but to no avail.
Can anyone help in ensuring the macro will NOT activate until the enter key is pressed?

Thanks


Posted by Jack in the UK on February 12, 2002 2:38 PM

Hi--

Dont like the sound of if mouse in cell activate or if data input.. you need to decide one or the other as mouse select will be first so thats all your get. Maybe this will help..

Select and col A cell and press enter NOTHING
Seect any Col A cell and type JACK and press enter
Turns cell green.. Replace with you code.

HTH
Jack in the UK

>>>>>>

Private Sub Worksheet_Change(ByVal Target As Range)
'Created by Jack in The UK
'On Thursday 12th Feb 2002

'----- MUST be in the VBE _
in the sheet you want target _
set to ie SHEET 1 not Moduel

If Target.Column = 1 Then
' Jack Sets Col A as Trigger (Target)
If ActiveCell <> 0 Then
' Jack Sets - that if cell is touched _
and no data will _
Stay as blank with no colour
Target.Select
With Selection.Interior
.ColorIndex = 4 ' Jack chooses Bright Green (as i like that it)
.Pattern = xlSolid
' Jack sets the cloour if <> Nothing
End With
'Jack Set - ends the WITH
End If
'Jack Set - ends one IF
End If
'Jack Set - ends the other IF
End Sub ' JACK finishes ... Good luck