View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_3_] Jim Thomlinson[_3_] is offline
external usenet poster
 
Posts: 983
Default 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