Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
macro for selecting non-adjacent cells
how can i edit the below line so that row no. will be a variable. i.e. if i
select cell "A5" the "3" will become 5. Range("A3,C3,E3,H3,K3").Select thanks for any help. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
macro for selecting non-adjacent cells
Range("A" & ActiveCell.Row & ",C" & ActiveCell.Row & ",E" & ActiveCell.Row &
",H" & ActiveCell.Row & ",K" & ActiveCell.Row).SELECT "EricBB" wrote: how can i edit the below line so that row no. will be a variable. i.e. if i select cell "A5" the "3" will become 5. Range("A3,C3,E3,H3,K3").Select thanks for any help. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
macro for selecting non-adjacent cells
I'd use:
Dim iRow As Long Dim myRng As Range iRow = 5 'or activecell.row With ActiveSheet Set myRng = Intersect(.Rows(iRow), .Range("a1,c1,e1,h1,k1").EntireColumn) End With myRng.Select EricBB wrote: how can i edit the below line so that row no. will be a variable. i.e. if i select cell "A5" the "3" will become 5. Range("A3,C3,E3,H3,K3").Select thanks for any help. -- Dave Peterson |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
macro for selecting non-adjacent cells
Use this for the row where the activecell is
Cells(ActiveCell.Row, 1).Range("A1,C1,E1,H1,K1").Select -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "EricBB" wrote in message ... how can i edit the below line so that row no. will be a variable. i.e. if i select cell "A5" the "3" will become 5. Range("A3,C3,E3,H3,K3").Select thanks for any help. |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
macro for selecting non-adjacent cells
Obvioucly i am new to this just curious how can you refer to a range object
from a cells method Isnt range higher in the object hierachy Thanks in advance "Ron de Bruin" wrote: Use this for the row where the activecell is Cells(ActiveCell.Row, 1).Range("A1,C1,E1,H1,K1").Select -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "EricBB" wrote in message ... how can i edit the below line so that row no. will be a variable. i.e. if i select cell "A5" the "3" will become 5. Range("A3,C3,E3,H3,K3").Select thanks for any help. |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
macro for selecting non-adjacent cells
thanks a lot CMK, Dave, Ron.
"EricBB" wrote: how can i edit the below line so that row no. will be a variable. i.e. if i select cell "A5" the "3" will become 5. Range("A3,C3,E3,H3,K3").Select thanks for any help. |
#7
Posted to microsoft.public.excel.misc
|
|||
|
|||
macro for selecting non-adjacent cells
Hi CmK
It is an unusual way of using range I agree. I believe I saw Tom O posted it first a few years ago. When you enter for example €śCells€ť you will see that range is in the Intellisense Dropdown after you press the. (Dot after cells) And you see that it is working OK -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "CmK" wrote in message ... Obvioucly i am new to this just curious how can you refer to a range object from a cells method Isnt range higher in the object hierachy Thanks in advance "Ron de Bruin" wrote: Use this for the row where the activecell is Cells(ActiveCell.Row, 1).Range("A1,C1,E1,H1,K1").Select -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "EricBB" wrote in message ... how can i edit the below line so that row no. will be a variable. i.e. if i select cell "A5" the "3" will become 5. Range("A3,C3,E3,H3,K3").Select thanks for any help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Keyboard Navigation - selecting non-adjacent rows | Excel Discussion (Misc queries) | |||
Selecting all cells using macro | Excel Discussion (Misc queries) | |||
By selecting cells adjacent to cells tally sheet | Excel Worksheet Functions | |||
selecting adjacent cells | New Users to Excel | |||
selecting non adjacent cells | Excel Worksheet Functions |