View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default Copy Dates and Hours Sub

You may want to step through this. I just have DEBUG.PRINT statements for
now. If it's what you need and you have more questions, come back. (this
took some thinking)

Sub AttendanceCode()
Dim Attendance As Range
Dim AttendanceDates As Range
Dim AttDate As Range
Dim Students As Range
Dim Student As Range
Dim StudentDate As Range
Dim mySheet As Worksheet

Dim r As Range
Set mySheet = Sheets("Attendance Letter")

Set Student = mySheet.Range("A33:A150")
Set AttendanceDates = mySheet.Range("X$27:$IV$27")
Debug.Print AttendanceDates.Address
For Each Student In Students
StudentDate = ""
For Each AttDate In AttendanceDates
Attendance = mySheet.Cells(Student.Row, AttDate.Column)
If Not IsEmpty(Attendance) Then
Debug.Print Student.Value, AttDate.Value, Attendance.Value
End If
Next AttDate
Next Student
End Sub


HTH,
Barb Reinhardt
"St@cy" wrote:

I'm trying to make a sub PrintAttendance (student).

On sheet "Attendance Letter", I want to copy the dates and hours (skipping
days absent) of a selected student. On sheet "Attendance", the student's
names are located A33:A150, their attendance hours X33:IV150 (each row a
different student), and the corresponding dates are located $X$27:$IV$27.

So far, I just have a mess. Please help me!