View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Running a variable macro when any value is entered into a variable

Hi Ian,

Your code works for me.

Perhaps events have been inadevertently turned off. To resolve this, in the
VBE immediate window type:

Application.EnableEvents = True

and hit the Enter key.

Incidentally, i think that your procedu

Sub DATA1()


Range("E9").Select
ActiveCell.FormulaR1C1 = "=TODAY()"
Range("E9").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("F9").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = ""
Range("F9").Select

End Sub


could be expressed as:

'=============
Sub DATA1()
With Range("E9")
.Value = Date
.Offset(0, 1).ClearContents
.Offset(0, 1).Select
End With
End Sub
'<<=============


---
Regards,
Norman



wrote in message
oups.com...
John

I have tried using the worksheet_change event as follow:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

If Target.Column = 3 Then DATA1

End Sub

Along with the Macro:

Sub DATA1()


Range("E9").Select
ActiveCell.FormulaR1C1 = "=TODAY()"
Range("E9").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("F9").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = ""
Range("F9").Select

End Sub

However, When I select C9 and click off it, nothing happens. Although
E9 should have todays date value in it. Can you see where I am going
wrong? I am using Excel 2003, and Column 3(C) is a dropdown list of
values.

Kind Regards