Rewritting of macro
Posted by Ben on November 05, 2001 11:15 AM
Could anyone PLEASE help me write a more concise version of the macro below?
It is designed to look at the table in the tblGym_Bookings sheet and find all the times matching a particular time and then go to the sheet BookingSheet and copy the details into the next cell on the row for that time which has a free cell below as well. The code between start and finish in my version of the macro is repeated for every half an hour until 17:30. which makes it makes it too long.
I thought that it may be possible to have the times listed within the macro, so it says something along the lines of for each of these times if the times in the coloumn equal them then copy them to the correct row in the booking sheet table rather thatn having 24 if formulas.
I have uploaded the workbook without the macro to: www.geocities.com/benspencer_2000/bookingsheet.zip
Dim Cell As Range
For Each Cell In Sheets("tblGym_Bookings").Range("C2:C300")
If Cell.Offset(0, 0).Text = "07:30" Then
ID = Cell.Offset(0, -1)
Name = Cell.Offset(0, -2)
If ActiveCell = "" And ActiveCell.Offset(1, 0) = "" Then
ActiveCell.Value = Name
ActiveCell.Offset(1, 0).Value = ID
Application.CutCopyMode = False