Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select specific columns for a given cell selection
I want to select the first four columns ("A:D") of what ever row the user
selects a cell in, using a "Selection_Change" event. So if I click cell A4, cells A4:D4 are selected. Likewise, if I click cell C4, cells A4:D4 are selected. Sure it's an easy script that I've just overlooked, but could use someone's help. Thanks, Mike |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select specific columns for a given cell selection
try this...
Private Sub Worksheet_SelectionChange(ByVal Target As Range) On Error GoTo ErrorHandler Application.EnableEvents = False If Target.Column <= 4 Then Range(Cells(Target.Row, 1), Cells(Target.Row, 4)).Select End If ErrorHandler: Application.EnableEvents = True End Sub HTH "crazybass2" wrote: I want to select the first four columns ("A:D") of what ever row the user selects a cell in, using a "Selection_Change" event. So if I click cell A4, cells A4:D4 are selected. Likewise, if I click cell C4, cells A4:D4 are selected. Sure it's an easy script that I've just overlooked, but could use someone's help. Thanks, Mike |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select specific columns for a given cell selection
Thank you Jim. This was a great help. Knew it was something fairly simple.
Mike "Jim Thomlinson" wrote: try this... Private Sub Worksheet_SelectionChange(ByVal Target As Range) On Error GoTo ErrorHandler Application.EnableEvents = False If Target.Column <= 4 Then Range(Cells(Target.Row, 1), Cells(Target.Row, 4)).Select End If ErrorHandler: Application.EnableEvents = True End Sub HTH "crazybass2" wrote: I want to select the first four columns ("A:D") of what ever row the user selects a cell in, using a "Selection_Change" event. So if I click cell A4, cells A4:D4 are selected. Likewise, if I click cell C4, cells A4:D4 are selected. Sure it's an easy script that I've just overlooked, but could use someone's help. Thanks, Mike |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how to select entire row and column in a sigle cell selection | Excel Worksheet Functions | |||
Select last cell in Selection | Excel Discussion (Misc queries) | |||
I need a specific value in auto filter to fill a combo box and than match the select value in 2 other columns. | Excel Worksheet Functions | |||
Lock data in a cell a specific cell based on selection on other ce | Excel Worksheet Functions | |||
Select specific cell | Excel Discussion (Misc queries) |