ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   select multiple cells (https://www.excelbanter.com/excel-programming/400683-select-multiple-cells.html)

sharmashanu

select multiple cells
 
Hi All
How do I select multiple cells using macro.
I tried the following and it selects only the last cell

starta.Offset(i, j).Select
starta.Offset(i + 1, j).Select
starta.Offset(i + 2, j).Select

Tell me how can i correct this macro code.

Thanks

Shanu


meg99

select multiple cells
 
On Nov 6, 11:28 am, sharmashanu wrote:
Hi All
How do I select multiple cells using macro.
I tried the following and it selects only the last cell

starta.Offset(i, j).Select
starta.Offset(i + 1, j).Select
starta.Offset(i + 2, j).Select

Tell me how can i correct this macro code.

Thanks

Shanu


Range("A1:D12").select

meg99


Gary''s Student

select multiple cells
 
For any three cells you can always use UNION()

UNION(starta.Offset(i, j), starta.Offset(i + 1, j), starta.Offset(i + 2,
j)).Select

--
Gary''s Student - gsnu2007a


"sharmashanu" wrote:

Hi All
How do I select multiple cells using macro.
I tried the following and it selects only the last cell

starta.Offset(i, j).Select
starta.Offset(i + 1, j).Select
starta.Offset(i + 2, j).Select

Tell me how can i correct this macro code.

Thanks

Shanu



sharmashanu

select multiple cells
 
Hi Gary
It worked thanks. Thanks for teaching me new function.

Shanu



All times are GMT +1. The time now is 02:37 PM.

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