CiderDrinker
New Member
- Joined
- Apr 26, 2013
- Messages
- 16
<tbody>
[TD="class: votecell"][/TD]
[TD="class: postcell"]I am a martial arts instructor and I keep my attendance records in an Excel workbook. There is one worksheet for each of four schools, a Master and a Consolidated (as the students are allowed to train at more than one venue, so I need to have a record of their attendance at their "home" venue and any extras they do on top). This works well, but is very laborious when a new student joins, as I need to insert their name into the correct alphabetised position in the Master sheet as well as on all of the individual school worksheets.
I would like some advice on how to automate this part of the process. I have researched this via Google but cannot find anything that quite meets what I am trying to achieve. I imagine it would also be useful for anyone else who keeps attendance registers for more than one venue
The spreadsheet contains the student name, their home school and the month, with the subsequent columns headed with the numbers 1 to 31 and a formula to sum these (I enter a 1 for each hour they attend under each date). At the moment, when somebody new joins the class, I go to their position in the register, insert a row, and enter their basic details. I then use the following simple macro to copy that row down 11 times (for the remaining months) and insert each of the months of the year
<code>Sub CopyDownStudent()
For i = 1 To 11
ActiveCell.Offset(1, 0).EntireRow.Insert
ActiveCell.EntireRow.Copy ActiveCell.Offset(1, 0).EntireRow
Next
For i = 0 To 11
ActiveCell.Offset(i, 3).Formula = "=DATE(YEAR(NOW())," & i + 1 & ",1)"
Next
End Sub
</code>
That works well on the Master sheet, but the really slow bit happens from that point onwards. Each of the school worksheets, and the Consolidated one, references the Master sheet to get the student data (eg =Master!A2), so I have to find the same row number as the first on the new Master sheet, insert 12 rows and then copy the formulae down from the last populated row to the 12 new ones, and then repeat that for each of the schools.
Can I please have some help to add that on to the existing macro, ie to identify the rows that have just been created on the Master sheet and replicate the insertion of 12 rows at the same position in each of the other worksheets, then copy the formulae down from the first four columns from the row immediately above the newly inserted rows into each worksheet.
I have tried to explain in as much detail as I can what I am trying to achieve, and may have included some irrelevant information in there, but was trying to give some context to better explain it. If I have missed off anything important, please let me know.
[/TD]
</tbody>
Last edited: