+ Reply to Thread
Results 1 to 3 of 3

Macro triggered by an event

  1. #1
    AussieAVguy
    Guest

    Macro triggered by an event

    Hi there,

    I'm not too good with the whole VBA programming so I need some help to
    create a macro.

    What I need is a macro triggered by an event.

    If I enter a value in a cell in col A I want the macro to automaticlly enter
    the current time in Col B of the same row using the Now () function.

    This is for an audio recording log sheet. I enter the microphone number
    that a person speaks from and the time is automaticlly filled in in the cell
    next to it. I can then do a VLOOKUP to get the persons name etc.

    I'd also like to create a macro that copies the formulas from the current
    row to the row below so that I don't have a log sheet 10 pages long when I
    only have 5 pages of data entered.

    Thanks for any help clever people


  2. #2
    Bob Phillips
    Guest

    Re: Macro triggered by an event

    Even though you're an Aussie I will try to help <bg>

    Private Sub Worksheet_Change(ByVal Target As Range)

    On Error GoTo ws_exit:
    Application.EnableEvents = False
    If Not Intersect(Target, Me.Range("A1:A1000")) Is Nothing Then
    With Target
    .Offset(0, 1).Value = Time
    .EntireRow.AutoFill .EntireRow.Resize(2)
    .Offset(1, 0).ClearContents
    Application.CutCopyMode = False
    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.



    --
    HTH

    Bob Phillips

    "AussieAVguy" <[email protected]> wrote in message
    news:[email protected]...
    > Hi there,
    >
    > I'm not too good with the whole VBA programming so I need some help to
    > create a macro.
    >
    > What I need is a macro triggered by an event.
    >
    > If I enter a value in a cell in col A I want the macro to automaticlly

    enter
    > the current time in Col B of the same row using the Now () function.
    >
    > This is for an audio recording log sheet. I enter the microphone number
    > that a person speaks from and the time is automaticlly filled in in the

    cell
    > next to it. I can then do a VLOOKUP to get the persons name etc.
    >
    > I'd also like to create a macro that copies the formulas from the current
    > row to the row below so that I don't have a log sheet 10 pages long when I
    > only have 5 pages of data entered.
    >
    > Thanks for any help clever people
    >




  3. #3
    AussieAVguy
    Guest

    Re: Macro triggered by an event

    Thanks Bob,

    That works nicely.

    Cheers

    "Bob Phillips" wrote:

    > Even though you're an Aussie I will try to help <bg>
    >
    > Private Sub Worksheet_Change(ByVal Target As Range)
    >
    > On Error GoTo ws_exit:
    > Application.EnableEvents = False
    > If Not Intersect(Target, Me.Range("A1:A1000")) Is Nothing Then
    > With Target
    > .Offset(0, 1).Value = Time
    > .EntireRow.AutoFill .EntireRow.Resize(2)
    > .Offset(1, 0).ClearContents
    > Application.CutCopyMode = False
    > 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.
    >
    >
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > "AussieAVguy" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hi there,
    > >
    > > I'm not too good with the whole VBA programming so I need some help to
    > > create a macro.
    > >
    > > What I need is a macro triggered by an event.
    > >
    > > If I enter a value in a cell in col A I want the macro to automaticlly

    > enter
    > > the current time in Col B of the same row using the Now () function.
    > >
    > > This is for an audio recording log sheet. I enter the microphone number
    > > that a person speaks from and the time is automaticlly filled in in the

    > cell
    > > next to it. I can then do a VLOOKUP to get the persons name etc.
    > >
    > > I'd also like to create a macro that copies the formulas from the current
    > > row to the row below so that I don't have a log sheet 10 pages long when I
    > > only have 5 pages of data entered.
    > >
    > > Thanks for any help clever people
    > >

    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1