Hi Paul, thank you again!!! It works perfectly:)
Best regards, seba On 29 sep., 15:32, Paul Schreiner <schreiner_p...@att.net> wrote: > Evidently, the Target array doesn't start at '0' like normal arrays! > > change the loop to: > For inx = 1 To Target.Count > > and it should work just fine. > > 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: Paul Schreiner <schreiner_p...@att.net> > To: excel-macros@googlegroups.com > Sent: Thu, September 29, 2011 8:49:58 AM > Subject: Re: $$Excel-Macros$$ Audit Trail > > Interesting... > Can you please post the code you're using? > (at least for the loop) > > 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: Seba <sebastjan.hri...@gmail.com> > To: MS EXCEL AND VBA MACROS <excel-macros@googlegroups.com> > Sent: Thu, September 29, 2011 8:40:25 AM > Subject: Re: $$Excel-Macros$$ Audit Trail > > Hi Paul, > > thank you very much for aour effort. There is just one thing: I paste > 2 values in S14 and S15 and the macro records values in S13 and S14. > > Cold you please help. > > regards, > seba > > On 29 sep., 14:15, Paul Schreiner <schreiner_p...@att.net> wrote: > > > > > > > > > > > The trick here is knowing that when target.count > 1, then the Target Range > > becomes an array. > > So, to get the cell address and values, you have to loop through the array.. > > like: > > > Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) > > Dim inx > > Dim strFileName As String > > strFileName = "c:\temp\file_name.txt" 'Change as appropriate > > Open strFileName For Append As #1 > > If Target.Count > 1 Then > > For inx = 0 To Target.Count - 1 > > Print #1, ActiveWorkbook.Name _ > > & vbTab _ > > & Sh.Name _ > > & vbTab _ > > & Target(inx).Address _ > > & vbTab _ > > & Environ("username") _ > > & vbTab _ > > & Date _ > > & vbTab _ > > & Time _ > > & vbTab _ > > & Target(inx).Value > > Next inx > > Else > > Print #1, ActiveWorkbook.Name _ > > & vbTab _ > > & Sh.Name _ > > & vbTab _ > > & Target.Address _ > > & vbTab _ > > & Environ("username") _ > > & vbTab _ > > & Date _ > > & vbTab _ > > & Time _ > > & vbTab _ > > & Target.Value > > End If > > Close #1 > > 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: Seba <sebastjan.hri...@gmail.com> > > To: MS EXCEL AND VBA MACROS <excel-macros@googlegroups.com> > > Sent: Thu, September 29, 2011 4:18:58 AM > > Subject: $$Excel-Macros$$ Audit Trail > > > Hi all, > > > I need to setup a Audi Trail system for my excel workbooks and I found > > this code on the net by google search. > > ------------------------------------------------- > > Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As > > Range) > > > Dim strFileName As String > > strFileName = "Location\file_name.txt" 'Change as appropriate > > > Open strFileName For Append As #1 > > If Target.Count > 1 Then > > Print #1, ActiveWorkbook.Name & vbTab & Sh.Name & vbTab & > > Target.Address & vbTab & Environ("username") & vbTab & Date & vbTab & > > Time & vbTab & "Multiple cells changed" > > Else > > > Print #1, ActiveWorkbook.Name & vbTab & Sh.Name & vbTab & > > Target.Address & vbTab & Environ("username") & vbTab & Date & vbTab & > > Time & vbTab & Target.Value > > End If > > Close #1 > > > End Sub > > ---------------------------------------------------- > > > This does the job, but I would like to have all values logged when > > multiple cells are changed. > > Lets say I paste a range. In the log file it just states "Multiple > > cells changed". I tried modifying it, however with no success. > > > Can anyone please help? > > > Thank you. > > Best regards, > > seba > > > -- > >---------------------------------------------------------------------------------- > >- > > > Some important links for excel users: > > 1. Follow us on TWITTER for tips tricks and links > >:http://twitter.com/exceldailytip > > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310 > > 3. Excel tutorials athttp://www.excel-macros.blogspot.com > > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com > > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com > > > To post to this group, send email to excel-macros@googlegroups.com > > > <><><><><><><><><><><><><><><><><><><><><><> > > Like our page on facebook , Just follow below > >linkhttp://www.facebook.com/discussexcel > > -- > ---------------------------------------------------------------------------------- > > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links > :http://twitter.com/exceldailytip > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310 > 3. Excel tutorials athttp://www.excel-macros.blogspot.com > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > Like our page on facebook , Just follow below > linkhttp://www.facebook.com/discussexcel > -- > ---------------------------------------------------------------------------------- > > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links > :http://twitter.com/exceldailytip > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310 > 3. Excel tutorials athttp://www.excel-macros.blogspot.com > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > Like our page on facebook , Just follow below > linkhttp://www.facebook.com/discussexcel -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel