Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hey,
I have a spreadsheet that I need a macro to exectue after a particular valued is changed. I have 5 entry feilds I am looking to attach a time to once it is entered into a spreadsheet. I want it so that the user enters a value and then the time is inserted next to the value after it is entered. I have tried the following code but the problem is that as soon as the time is posted it loops the macro and then it launches after each time any of the cells is changed on the macro runs. Private Sub Worksheet_Change(ByVal Target As Range) Range("O6").Select Selection.Copy Range("O38").Select Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _ xlNone, SkipBlanks:=False, Transpose:=False End Sub I want it so say someone enters a value on A6 it takes the value of A6 and pastes it to T6 and then the time is inserted into T7...the macro stops. The next time the end users goes to A7 and enters a value it goes to T8 and then the new time goes to T9. Please help!!! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A6:A10" '<=== change to suit On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Range(WS_RANGE)) Is Nothing Then 'copy O to R Target.Offset(0, 14).Copy Target.Offset(0, 17).PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _ xlNone, SkipBlanks:=False, Transpose:=False End If ws_exit: Application.EnableEvents = True End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) wrote in message ps.com... Hey, I have a spreadsheet that I need a macro to exectue after a particular valued is changed. I have 5 entry feilds I am looking to attach a time to once it is entered into a spreadsheet. I want it so that the user enters a value and then the time is inserted next to the value after it is entered. I have tried the following code but the problem is that as soon as the time is posted it loops the macro and then it launches after each time any of the cells is changed on the macro runs. Private Sub Worksheet_Change(ByVal Target As Range) Range("O6").Select Selection.Copy Range("O38").Select Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _ xlNone, SkipBlanks:=False, Transpose:=False End Sub I want it so say someone enters a value on A6 it takes the value of A6 and pastes it to T6 and then the time is inserted into T7...the macro stops. The next time the end users goes to A7 and enters a value it goes to T8 and then the new time goes to T9. Please help!!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
'IF' Macro to insert cell contents to alternate cell if cell not e | Excel Worksheet Functions | |||
using a cell value to control a counter inside a macro and displaying macro value | Excel Worksheet Functions | |||
If cell is empty then run macro otherwise skip this macro | Excel Programming | |||
macro to run a separate macro dependent on value in cell | Excel Programming | |||
Question: Cell formula or macro to write result of one cell to another cell | Excel Programming |