PDA

View Full Version : macro



aoc
06-25-2009, 02:12 PM
Hi,

how can I revise below code when I click a cell date will write and " osman " will write next to date cell. ( like A1 B1 )


Sub Macro1()

ActiveCell.FormulaR1C1 = "=TODAY()"
ActiveCell.FormulaR1C1 = "osman"

stanleydgrom
06-25-2009, 03:46 PM
aoc,




Sub Macro1()
ActiveCell.Formula = "=TODAY()"
ActiveCell.Offset(, 1).Formula = "osman"
End Sub

Aussiebear
06-25-2009, 09:59 PM
The following code will work for a double click event

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Selection.Count > 1 Then Exit Sub
If Target.Column = 1 And Target.Row = 2 Then
Target.Value = "=Today()"
Target.Offset(0, 1).Value = "Osman"
Cancel = True
End If
End Sub
Download the attached workbook for an example of how it does so.