Consulting

Results 1 to 3 of 3

Thread: macro

  1. #1
    VBAX Regular aoc's Avatar
    Joined
    Apr 2007
    Location
    Istanbul
    Posts
    90
    Location

    macro

    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"
    OSMAN

  2. #2
    VBAX Tutor
    Joined
    Nov 2006
    Location
    North East Pennsylvania, USA
    Posts
    203
    Location
    aoc,

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

  3. #3
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,059
    Location
    The following code will work for a double click event

    [vba]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[/vba]
    Download the attached workbook for an example of how it does so.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •