ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Referencing Cells (https://www.excelbanter.com/excel-programming/273566-referencing-cells.html)

Sok Hong

Referencing Cells
 
This is my first time programming in VBA and I seem to
have some difficulty in referencing cells.

In the code I am writing I need to set a cell as a base
point, I know of the row for the base point but not the
column. After base cell is established, I would need to
reference other cells in reference to the base point cell
(Column for the base point may change in each iteration).

Here's the code I've tried using, but the third line gives
me an error.

Range("B30").End(xlToRight).Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=-1).Select
Range(Cells("31", ActiveCell.Column)).Select

Can someone help me with this? Thank you.

Eddy[_3_]

Referencing Cells
 
From the 3rd line of your codes, it seems to me that you only need:-

Cells(31, ActiveCell.Column).Select

If you want to select a cell, you don't necessarily need a range object. A
cell object will do the job.


"Sok Hong" ?????
...
This is my first time programming in VBA and I seem to
have some difficulty in referencing cells.

In the code I am writing I need to set a cell as a base
point, I know of the row for the base point but not the
column. After base cell is established, I would need to
reference other cells in reference to the base point cell
(Column for the base point may change in each iteration).

Here's the code I've tried using, but the third line gives
me an error.

Range("B30").End(xlToRight).Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=-1).Select
Range(Cells("31", ActiveCell.Column)).Select

Can someone help me with this? Thank you.





All times are GMT +1. The time now is 04:06 AM.

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