ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Expanding a Selection (https://www.excelbanter.com/excel-programming/355135-expanding-selection.html)

Shorty[_3_]

Expanding a Selection
 
Hello
I want the user selection of cells to always select the whole row of
selected cells but only starting from column B to column E.
Selection.EntireRow.Select works well but i need to deselect some
columns from this. any help would be great!
Thanks
Shorty


damorrison

Expanding a Selection
 
ActiveCell.Range("A1:C1,E1,G1,I1:J1,L1,N1").Select

or

Range("A12:C12,E12,G12,J12:M12").Select

You may have to fiddle with this to meet your requirements


Ardus Petus

Expanding a Selection
 
In a module, add following subroutine:

Sub selBE()
Range(Cells(ActiveCell.Row, "B"), Cells(ActiveCell.Row, "E")).Select
End Sub

Associate a shortcut (Ctrl-S for instance)

HTH
--
AP

"Shorty" a écrit dans le message de
oups.com...
Hello
I want the user selection of cells to always select the whole row of
selected cells but only starting from column B to column E.
Selection.EntireRow.Select works well but i need to deselect some
columns from this. any help would be great!
Thanks
Shorty




Shorty[_3_]

Expanding a Selection
 
wont that replace the user selected cells with predefinded range?


Dave Peterson

Expanding a Selection
 
dim myRng as range
with activesheet
set myrng = intersect(.range("b:e"),selection.entirerow)
end with
msgbox myrng.address

Shorty wrote:

Hello
I want the user selection of cells to always select the whole row of
selected cells but only starting from column B to column E.
Selection.EntireRow.Select works well but i need to deselect some
columns from this. any help would be great!
Thanks
Shorty


--

Dave Peterson

Shorty[_3_]

Expanding a Selection
 
Thanks, this one almost did it, the user can select multiple rows and
this only selects the last row in the selection.
Range(Cells(ActiveCell.Row, "B"), Cells(ActiveCell.Row, "E")).Select
but it selects the right columns which will come in useful!!!


Shorty[_3_]

Expanding a Selection
 
ah ha fantastic this code does the trick. Selects the columns B to E
for the whole user selection. Thanks very much, problem solved in what,
17 mins, Thanks everyone!



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

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