ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to select cells? (https://www.excelbanter.com/excel-programming/292367-how-select-cells.html)

Pandi

How to select cells?
 
I have some table, I want in my VB code to select all the cells in th
table except the header.
How do I do that so if I will want to add in the future another cell
to this table the VBA code will include automatically this cells?

I had try to user the Lines:
Range(ActiveCell, ActiveCell.End(xlDown)).Select
Range(ActiveCell, ActiveCell.End(xToRight)).Select
(The active cell is "A2"

--
Message posted from http://www.ExcelForum.com


papou[_7_]

How to select cells?
 
Hello Pandi
See VBA help for CurrentRegion and Offset
HTH
Regards
Pascal

"Pandi " a écrit dans le message de
...
I have some table, I want in my VB code to select all the cells in the
table except the header.
How do I do that so if I will want to add in the future another cells
to this table the VBA code will include automatically this cells?

I had try to user the Lines:
Range(ActiveCell, ActiveCell.End(xlDown)).Select
Range(ActiveCell, ActiveCell.End(xToRight)).Select
(The active cell is "A2")


---
Message posted from http://www.ExcelForum.com/




papou[_7_]

How to select cells?
 
Some sample code:
Dim Tbl As Range
Set Tbl = Range("A1").CurrentRegion
Tbl.Offset(1, 0).Resize(Tbl.Rows.Count - 1, _
Tbl.Columns.Count).Select
Regards
Pascal


"papou" <DésoléPasDeMail a écrit dans le message de
...
Hello Pandi
See VBA help for CurrentRegion and Offset
HTH
Regards
Pascal

"Pandi " a écrit dans le message de
...
I have some table, I want in my VB code to select all the cells in the
table except the header.
How do I do that so if I will want to add in the future another cells
to this table the VBA code will include automatically this cells?

I had try to user the Lines:
Range(ActiveCell, ActiveCell.End(xlDown)).Select
Range(ActiveCell, ActiveCell.End(xToRight)).Select
(The active cell is "A2")


---
Message posted from http://www.ExcelForum.com/







All times are GMT +1. The time now is 11:31 PM.

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