You misspelled "Change" in Worksheet_Change ?? If you use the "Wizard" in VBE it would avoid this: (top-left pulldown to select "Worksheet", top-right pulldown to select "Change") also, might I suggest using something like: Private Sub Worksheet_change(ByVal Target As Excel.Range) Dim Targ As Range Dim rChange As Range On Error GoTo ErrHandler Set rChange = Intersect(Target, Range("A:A")) For Each Targ In Target If (Targ.Value <> "") Then Application.EnableEvents = False With Targ.Offset(0, 1) .Value = Now .NumberFormat = "hh:mm:ss" End With Else Application.EnableEvents = False Targ.Offset(0, 1).Clear End If Next Targ ExistHandler: Application.EnableEvents = True Exit Sub ErrHandler: MsgBox Err.Description Resume ExistHandler End Sub
Paul ----------------------------------------- “Do all the good you can, By all the means you can, In all the ways you can, In all the places you can, At all the times you can, To all the people you can, As long as ever you can.” - John Wesley ----------------------------------------- From: Steve st-pierre <stpierre.ste...@gmail.com> >To: excel-macros@googlegroups.com >Sent: Saturday, November 22, 2014 9:46 PM >Subject: $$Excel-Macros$$ Re: Want to get your question answered quickly? > > > >How could get this micro to work in excel. The macro should write the time in >one row (Row A - field 1) when something is written in the second row (Row B - >field 2). When I add this to any excel (Excel on mac 14.4.6) file I don't even >get any errors. Could someone help me to tell me why it doesn't work ? > > >Thank you, > > >Steve > > > >Private Sub Worksheet_chage(ByVal Target As Excel.Range) > Dim rCell As Range > Dim rChange As Range > > On Error GoTo ErrHandler > Set rChange = Intersect(Target, Range("A:A")) > If Not rChange Is Nothing Then > Application.EnableEvents = False > For Each rCell In rChange > If rCell > " " Then > With rCell.Offset(0, 1) > .Value = Now > .NumberFormat = "hh:mm:ss" > End With > Else > rCell.Offset(0, 1).Clear > End If > Next > End If > > >ExistHandler: > Set rCell = Nothing > Set rChange = Nothing > Application.EnableEvents = True > Exit Sub >ErrHandler: > MsgBox Err.Description > Resume ExistHandler >End Sub > > >Le samedi 3 novembre 2012 03:34:25 UTC-4, Ayush Jain a écrit : > >>Dearmembers, >> >>If you keep below points in mind while asking your query, The chances to get >>answered is just high : >> >> 1. Ensure your question is not too vague. Don't assume anyone is >> familiar with your problem. While you can upload small attachments, describe your problem in the body of the post. We are fortunate to have several Excel gurus, but few mind-readers. >> 2. On the other hand, skip irrelevant details. Be descriptive and >> concise. Short, direct, and to-the-point questions with apt thread titles are almost always answered promptly. >> 3. Keep the scope reasonably narrow. Questions like, "How do I set up >> an accounting system in Excel?" might be a long time waiting. >> 4. Explain what you've already tried. ("Calculation is set to >> automatic, but formulas still don't compute") so helpers don't waste your >> time or theirs. >> 5. Post a WORKBOOK. Nobody wants to type data from a picture or paste >> text from your post into a spreadsheet as a prelude to helping. To attache a file, You can email them as attachments to your group's email address excel-...@googlegroups.com OR Simply "Attach a file" during posting in New Google Groups. >> 6. If your question has not been answered within a day, consider adding >> another post with any additional information you believe is relevant. >> 7. Use {} from the post menu to highlight the syntax >> Many Thanks >> Keep Posting, >> -Ayush Jain(Group Manager) >> >> >> >> >> >> >> >> >> >> >> -- >Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s >=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ >https://www.facebook.com/discussexcel > >FORUM RULES > >1) Use concise, accurate thread titles. Poor thread titles, like Please Help, >Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get >quick attention or may not be answered. >2) Don't post a question in the thread of another member. >3) Don't post questions regarding breaking or bypassing any security measure. >4) Acknowledge the responses you receive, good or bad. >5) Jobs posting is not allowed. >6) Sharing copyrighted material and their links is not allowed. > >NOTE : Don't ever post confidential data in a workbook. Forum owners and >members are not responsible for any loss. >--- >You received this message because you are subscribed to the Google Groups "MS >EXCEL AND VBA MACROS" group. >To unsubscribe from this group and stop receiving emails from it, send an >email to excel-macros+unsubscr...@googlegroups.com. >To post to this group, send email to excel-macros@googlegroups.com. >Visit this group at http://groups.google.com/group/excel-macros. >For more options, visit https://groups.google.com/d/optout. > > > -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout.