LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Keeping a log of activity in a worksheet in a second worksheet in same workbook. Phew.

I'm hitting my head against a brick wall trying to get my subroutine
to work, so I'm coming for help.

I use many spreadsheets in a school and need to track pupils' work as
they work on assignments, so I have got some trackers that enable me
to see how they are all getting along. One of the problems I have had
is being able to track progress within a lesson. With 30 pupils and
multiple pieces of work to check, it is easy for me to be able to miss
a couple of pupils who manage to dodge showing me any work. So I wrote
a routine (below) that enables me to use conditional formatting to
highlight those pupils who have yet to have any changes in a row of
data against their name.

It works fine.

So I thought I would adapt it a little. Just a small change....

What I want the routine to do is add a row of data to a second
worksheet in the same workbook. It needs to find the last row of the
worksheet, move down a row, and then add the same details that are
written to cells in the routine. And maybe the application.user as
well.

But I just cannot figure out how to do it.

I've turned error checking back on by commenting out the On Error
statement in the code below (so I can attempt to see what's going
wrong)

The second sheet I have named ActivityLog.

I added a variable called NextRow

Dim NextRowInActivityLog As Long

but when I issued the command

NextRowInActivityLog = Range("ActivityLog!A65536").End(xlUp).Row + 1

I get
Runtime Error 1004

Method Range of object '_Worksheet' failed

And then any code where I attempt to "force" an update to the second
sheet (by explicitly stating the cell to update. I have tried using
With ("ActivityLog"), Sheets("ActivityLog").Select etc but am
stumbling around and not understanding what I am doing any more. It's
kinda trial and error...

I want to find the next blank row in the second workbook, and then add
a line with the details shown on the first sheet, so I have a complete
log of who got which mark when, and which teacher awarded the mark.

If anyone can suggest improvements to the existing code as well as
helping me write the log, that would be really appreciated.

Thanks for the help :)

Noz



Existing code is here...

Dim IgnoreThisEvent As Boolean

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

'Subroutine to track the marks awarded on a tracker
'080614 PNO

'Declarations
Dim VRangeDateOfMostRecentChange As Range
Dim VRangeDateOfPreviousChange As Range
Dim VRangeMarkAwardedFor As Range
Dim VRangeMarks As Range
Dim VRangeMarkTitle As Range
Dim VRangeToday As Range
Dim NextRowInActivityLog As Long

'Turn off error handling. If an error occurs, then the sheet won't
be updated
'With it's turned on, it won't be updated either - but an error
message will be displayed
'So I'm switching it off to prevent error messages being
displayed.
On Error Resume Next

'Initialisation
Set VRangeDateOfMostRecentChange =
Range("RangeDateOfMostRecentChange")
Set VRangeDateOfPreviousChange =
Range("RangeDateOfPreviousChange")
Set VRangeMarkAwardedFor = Range("RangeMarkAwardedFor")
Set VRangeMarks = Range("RangeMarks")
Set VRangeMarkTitle = Range("RangeMarkTitle")
Set VRangeToday = Range("RangeToday")

If IgnoreThisEvent Or Target.Count 1 Then Exit Sub

IgnoreThisEvent = True

If Not Intersect(Target, VRangeMarks) Is Nothing Then

'Update the most recent change date

'If there is no current update date, then simply update the
date of update
'Otherwise update both current and previous update dates

If VRangeDateOfMostRecentChange.Cells(Target.Row) = "" Then
VRangeDateOfMostRecentChange.Cells(Target.Row) = Now()
Else
VRangeDateOfPreviousChange.Cells(Target.Row) =
VRangeDateOfMostRecentChange.Cells(Target.Row)
VRangeDateOfMostRecentChange.Cells(Target.Row) = Now()
End If

'Update the reason the mark was awarded
VRangeMarkAwardedFor.Cells(Target.Row) =
VRangeMarkTitle.Cells(Target.Column)

'Put a "Yes" in the RangeToday
VRangeToday.Cells(Target.Row) = "Yup"

End If

IgnoreThisEvent = False

End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Keeping a text box on the worksheet Twin10 Excel Worksheet Functions 0 May 13th 09 05:06 PM
Adding a chart to large workbook brings workbook activity to a hal Dale Excel Discussion (Misc queries) 6 December 29th 08 05:50 PM
Keeping the formatting from one worksheet to another? Beard Excel Discussion (Misc queries) 1 July 30th 06 11:14 PM
Detecting Worksheet Activity Trev T Excel Programming 2 December 5th 03 04:46 PM
tracking user activity on worksheet Wei-Dong Xu [MSFT] Excel Programming 0 November 5th 03 01:30 AM


All times are GMT +1. The time now is 09:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"