Private Sub cmdSubmit_Click()
Dim EmptyRow As Long
Dim MyRange As Range
Dim i As Integer
Dim newDate As Date
Set MyRange = Worksheets("Submissions").Range("A:A")
EmptyRow = Application.WorksheetFunction.CountA(MyRange) + 1
Set MyRange2 = Worksheets("DateLoop").Range("A:A")
EmptyRow2 = Application.WorksheetFunction.CountA(MyRange2) + 1
Sheets("Submissions").Cells(EmptyRow, 1).Value = txtFirstName.Value
Sheets("Submissions").Cells(EmptyRow, 2).Value = txtLastName.Value
Sheets("Submissions").Cells(EmptyRow, 3).Value = txtNumGuests.Value
Sheets("Submissions").Cells(EmptyRow, 4).Value = txtPhone.Value
Sheets("Submissions").Cells(EmptyRow, 5).Value = txtEmail.Value
Sheets("Submissions").Cells(EmptyRow, 6).Value = tbstdate.Value
Sheets("Submissions").Cells(EmptyRow, 7).Value = tbenddate.Value
Sheets("Submissions").Cells(EmptyRow, 8).Value = txtNumDays.Value
Sheets("Submissions").Cells(EmptyRow, 9).Value = txtPriceNight.Value
Sheets("Submissions").Cells(EmptyRow, 10).Value = txtEnvFee.Value
Sheets("Submissions").Cells(EmptyRow, 11).Value = txtEntFee.Value
Sheets("Submissions").Cells(EmptyRow, 12).Value = txtTotal.Value
Unload Me
For i = 0 To txtNumDays.Value
conDate = CDate(tbstdate.Value)
Sheets("DateLoop").Cells(EmptyRow2, 1).Value = conDate + i
Sheets("DateLoop").Cells(EmptyRow2, 2).Value = txtNumGuests.Value
Next i
End Sub
내가 할 수있게하려는 것은 루프의 일부가 될 모든 날짜를 맨 아래쪽에 표시하는 것입니다.Excel VBA 루프 사용
예 : 4 인용 12/17/14-12/22/14 예약의 경우 12/22/14 만 4 인용으로 삽입합니다. 손님이 매번 동일하게 유지 되더라도 새 행에 각 날짜 (모두 6 명)를 나열 할 수 있어야합니다. 목적은 일일 중 매일 얼마나 많은 사람들이 스케줄에 올랐는지 추적하는 것입니다. 따라서 매일 나열해야하는 이유가 있습니다.
제공 할 수있는 도움에 감사드립니다.
요구 사항을 명확히하고 Excel 워크 시트에 샘플 데이터를 표시하여 원하는 결과를 시각화하면 도움이됩니다. 좋은 점, –