excel vba 取得欄位值 取得儲存格的值

Step 1 在功能列「開發人員」中程式碼選擇「Visual Basic」

Step 2 複製貼上下方程式碼,修改儲存格位置,並按下執行即可
Sub GetValueOfCell()
Dim cellValue As Variant
' 獲取 A2 儲存格的值
cellValue = Range("A2").Value
' 將值顯示在消息框中
MsgBox "A2 儲存格的值為: " & cellValue
End Sub
【教學】Excel VBA 如何取得指定儲存格的值?超簡單馬上學會!