Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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" wrote in message ... 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
|
|||
|
|||
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" wrote in message ... 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help with macro looping and color query function | Excel Discussion (Misc queries) | |||
Playing a macro from another workbook | Excel Discussion (Misc queries) | |||
automatic macro update | Excel Worksheet Functions | |||
Date macro | Excel Discussion (Misc queries) | |||
Macro and If Statement | Excel Discussion (Misc queries) |