5 つの整数を宣言しました
Public Hol_1 as integer
Public Hol_2 as integer
Public Hol_3 as integer
Public Hol_4 as integer
Public Hol_5 as integer
3 つのクライアントがあり、Hol_1 から Hol_3 を使用するとします。これは次のことも意味します: iClients = 3 最初に、シート ("Holidays") を調べて、3 人のクライアントのそれぞれの休日の日数を確認する必要があります。
Sub CountHolidays()
Dim i as integer
Dim iclients as integer
iclients = 3
For i=1 to iclients
Hol_i = WorksheetFunction.CountA(ActiveWorkbook.Sheets("Holidays").Range(Cells(2, 3 + i), Cells(50, 3 + i)))
'The worksheetfunction calculates the amount of Holiday-dates I have for each of my three clients
Next i
End sub
Variable is not defined: Hol_i is not defined というコンパイル エラーが発生します。"Hol_" & i などを試しましたが、これを修正できませんでした。誰かアイデアがありますか?THX