ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   value of a cell on VB (https://www.excelbanter.com/excel-discussion-misc-queries/126026-value-cell-vbulletin.html)

Ross

value of a cell on VB
 
How do I get into VB the value of a cell?
More specifically: suppose I need to write a web query, where I need to
specify an address where a piece of it is the entry of cell A1?

thanks!!
Ross


JLatham

value of a cell on VB
 
myValueFromA1 = Worksheets("sheetName").Range("A1").Value

that is the most formal way of referring to the value in A1 on a sheet.
Since .Value is the default property you could shorten it to:

myValueFromA1 = Worksheets("sheetName").Range("A1")

and if the code is associated with the sheet itself, then
myValueFromA1 = Range("A1")
is acceptable.

If you are certain that the sheet with the A1 cell you are interested in is
the currently selected sheet (absolutely certain) then
myValueFromA1 = ActiveSheet.Range("A1")
would work.


"Ross" wrote:

How do I get into VB the value of a cell?
More specifically: suppose I need to write a web query, where I need to
specify an address where a piece of it is the entry of cell A1?

thanks!!
Ross




All times are GMT +1. The time now is 10:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com