Originally Posted by
TMS
@6SJ: hahhh, you copy my code, colour it in, and then call it inelegant!
Let's just say great minds think alike! I was just slow on the draw.
I just don't like having a loop with exceptions. Some languages would allow this
Formula:
For ApptCol = 4, 5, 6, 8, 9
but not VBA.
I guess you could do this. But I can't think of a good way to express "4-9 except 7" without writing the numbers individually.
Sub Appt_Load()
Dim ApptCol As Variant
With Schedule
If .Range("B9").Value = Empty Then
MsgBox "Please select a correct appointment"
Exit Sub
End If
ApptRow = .Range("B9").Value
.Range("E3").Value = Appts.Range("C" & ApptRow).Value 'Add in Contact Name
For Each ApptCol In Array(4, 5, 6, 8, 9)
.Range("E" & ApptCol + 1).Value = Appts.Cells(ApptRow, ApptCol).Value 'Add in Appt Details
Next ApptCol
End With
Schedule.Range("E3").Select
End Sub
Bookmarks