1
嗨,我想創建一定數量的組合框時按下一個commandbutton。我不知道該怎麼做,所以我會非常感謝你的幫助。這是創建的代碼:在循環VBA中創建組合框
Private Sub CommandButton1_Click()
Dim AttPoints As Integer, Result As String
Range("E1:Z4").ClearContents
AttPoints = Range("B2").Value
If AttPoints = 0 Then
Result = "You have selected 0 AttPoints!"
ElseIf AttPoints < 0 Then
Result = "You have selected a negative amount of AttPoints!"
ElseIf AttPoints > 0 Then
Dim i As Integer
For i = 5 To (AttPoints + 4)
Cells(1, i).Value = "Attachment point:" & (i - 4)
Next i
End If
Range("A1") = Result
End Sub
在for循環中,我創建了一行單元格,其中放置了文本附加點。 在這些文本下,我想要在圖片中看到相同數量的組合框。
謝謝!我還應該包含Private Sub CommandButton1_Click()部分? –
不,你只需要在你的循環中顯然包含3條線。如果問題解決了,請接受上面的答案作爲解決方案。 – Gess