VBA If Entire Row selected in Selection Change Event

decadence

Well-known Member
Joined
Oct 9, 2015
Messages
525
Office Version
  1. 365
  2. 2016
  3. 2013
  4. 2010
  5. 2007
Platform
  1. Windows
Hi, Is it possible to check if the Entire Row of Row 1 is Selected in the Selection Change Event? Can someone help please
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
How about
Code:
 If Target.Count = Columns.Count And Target.Row = 1 Then MsgBox "all"
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0
Bit late but just stumbled across this thread so thought I would post my suggestion anyway since it only requires a single check.

Code:
If Target.Address = "$1:$1" Then MsgBox "All of row 1 selected"
 
Upvote 0
Actually, on further consideration, I would highly recommend changing codes for this task as, without further checks/changes, Fluffs code could ..

a) Result in a message of "all" if you select, say, the range E1:AJ512 or J1:J16384 or any other range that starts in row 1 and contains 16,384 cells.
b) Cause a vba Overflow error if you select a very large number of cells (say selecting the whole sheet to set a new font)
 
Upvote 0
Good points Peter.
Also if you select more than one row, you wont get the message box.
 
Upvote 0
Also if you select more than one row, you wont get the message box.
That is the same with my code but I was assuming that was the desired outcome. Hopefully we will get some clarification from the OP in due course.
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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