VBA: Setting A Variable To A Specific Cell Value [closed] - Stack Overflow
Có thể bạn quan tâm
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this questionIn Sheet1 of my workbook, cell B2 has the value 29.
I want to assign a cell value to a variable, num_g.
I've declared num_g as Integer and am trying to assign its value with the code:
num_g = Worksheets("Sheet1!").Cells(1, 2).ValueI'm using Cells() as I plan to replace the row with a counter.
However, I keep getting the "Subscript out of range" error (run-time error 9), and don't understand why.
How can I fix this? Declaring num_g as Long or String doesn't help, nor does formatting cell B2 as a number.
Thanks in advance.
Từ khóa » Visual Basic Excel Set Cell Value
-
VBA Cell Value - Get, Set, Or Change - Automate Excel
-
VBA Enter Value In A Cell (Set, Get, And Change) - Excel Champs
-
Range.Value Property (Excel) - Microsoft Docs
-
How To Change A Cell Value Using VBA In Microsoft Excel - Quora
-
How To Change A Cell Value With VBA - Techwalla
-
Excel VBA: Set Variable To A Cell Value (3 Practical Examples)
-
VBA Ranges - Getting And Setting Cell Values
-
Excel VBA Tutorial: Update Cell Value With VBA - YouTube
-
Excel VBA Value And Value2: Step-by-Step Guide And 8 Examples
-
How To Set Variable To Cell Value In Excel VBA? - GeeksforGeeks
-
Get And Set Cell Value In Excel VBA - Developer Publish
-
Excel - VBA - Unable To Set Cell Value - Stack Overflow
-
Excel VBA: Change Cell Color Based On Value
-
Get Cell Value In Excel VBA - WallStreetMojo