Have Excel Automatically select 3 cells

hajiali

Well-known Member
Joined
Sep 8, 2018
Messages
626
Office Version
  1. 2016
Platform
  1. Windows
Hello is there a way I can have excel automatically select cells column A, B, and C together when i select any of the 3 columns. For ex. the info in B1 and C1 are info about A1 I want all 3 to be moved together at all time and not have a choose to moving or copy one cell with out the other. Kinda like group the 3 columns. Group A2, B2, C2 together A3,B3, C3 together etc....
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hello,

You could test following Event macro

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column > 3 Then Exit Sub
Range("A" & Target.Row & ":C" & Target.Row).Select
Cancel = True
End Sub

Hope this will help
 
Upvote 0
I tried the code in the Sheet2(RESULTS) it did not work.

Does the Code go into a Macro?

Also Im only needing this done in a specific sheet named "RESULTS" not to the rest of the sheets in the workbook.


Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column > 3 Then Exit Sub
Range("A" & Target.Row & ":C" & Target.Row).Select
Cancel = True
End Sub
 
Upvote 0
For your information, an Event macro is to stored in the respective Sheet module ...

Hope this clarifies
 
Upvote 0
Im really Sorry im not familiar and not sure how to create an event macro to a the sheet module?

For your information, an Event macro is to stored in the respective Sheet module ...

Hope this clarifies
 
Upvote 0
Place your pointer of your mouse on the sheet tab name ...

Right click to open the sub menu

Then select View Code

In this window which just opened ...

Copy Paste the following Event Macro :

Code:
[COLOR=#333333]Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
[/COLOR]If Target.Column > 3 Then Exit Sub
Range("A" & Target.Row & ":C" & Target.Row).Select
Cancel = True 
[COLOR=#333333]End Sub
[/COLOR]

In your sheet, whenever you double-click on any cell in Column A B or C ...

your range will be selected ...

Good Luck
 
Upvote 0
That works great. However, Is there a way when i just single left click to do the same as the this double click.

So instead of
Code:
[COLOR=#333333]BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)[/COLOR]

Have just one left click. I saw an option for BeforeRightClick but no BeforeLeftClick.

also BeforeLeftClick only on Column A to highlight Column B and C because i will need to be able to change values in Column B and C

Any suggestions?

Place your pointer of your mouse on the sheet tab name ...

Right click to open the sub menu

Then select View Code

In this window which just opened ...

Copy Paste the following Event Macro :

Code:
[COLOR=#333333]Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
[/COLOR]If Target.Column > 3 Then Exit Sub
Range("A" & Target.Row & ":C" & Target.Row).Select
Cancel = True 
[COLOR=#333333]End Sub
[/COLOR]

In your sheet, whenever you double-click on any cell in Column A B or C ...

your range will be selected ...

Good Luck
 
Last edited:
Upvote 0
Thanks for your Thanks ...

Glad to hear the Event macro operates as expected ... :smile:

Sorry there is no such thing as BeforeLeftClick ...
 
Upvote 0
You could also use that same logic in a Worksheet_SelectionChange event procedure, which runs whenever you simply select a cell in the first three columns.
It would go in the same place (Worksheet module), and look like this:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Column > 3 Then Exit Sub
    Range("A" & Target.Row & ":C" & Target.Row).Select
End Sub
 
Last edited:
Upvote 0
Thanks Joe4 that does work. But when trying to select multiple cell ex. A1:A20 it will not select B1:B20 and C1:C20 it only refers back to the first 3 columns A1,B1,C1. What im trying to do is to allow when i select a Range in Column A to also select that Range In B And C so I move them together. Not sure if that makes sense

You could also use that same logic in a Worksheet_SelectionChange event procedure, which runs whenever you simply select a cell in the first three columns.
It would go in the same place (Worksheet module), and look like this:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Column > 3 Then Exit Sub
    Range("A" & Target.Row & ":C" & Target.Row).Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,271
Members
452,628
Latest member
dd2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top