由於某些原因,運行此宏時沒有任何反應。我可能會做錯什麼?VBA和私有函數
(我試圖填補與隨機選擇的串範圍內的每個單元格。)
Sub ktr()
Dim dataRange As Range
Set dataRange = Range("A1:V35")
For Each cell In dataRange
response = azerothSays()
cell.Value = response
Next cell
End Sub
Private Function azerothSays()
Dim result As String
Select Case Rnd(6)
Case 1
result = "CELIBACY"
Case 2
result = "WORMS"
Case 3
result = "AGING"
Case 4
result = "MARRIAGE"
Case 5
result = "CHEMISTRY"
Case 6
result = "DISINTIGRATE"
End Select
azerothSays = result
End Function