我試圖循環通過每個工作表,並設置100行的列A到輸入參數的值。我希望每個表調用一個輸入框,並有列的值等於輸入,但正在發生的事情是,第一個工作表是獲得最後的輸入和所有columnA張值爲空,除了表1excel vba通過工作表循環,並根據輸入設置值
Dim wkbkorigin As Workbook
Set wkbkorigin = Workbooks.Open("C:\bookB.xls")
For Each ThisWorkSheet In wkbkorigin.Worksheets
Subject = InputBox("Enter the 'Subject' field for " & ThisWorkSheet.Name & ":")
For i = 1 To 100
Range("A2").Cells(i, 1) = Subject
Next
Next