Selecting Only Entire Rows

dominicwellsuk

New Member
Joined
Mar 23, 2011
Messages
28
Hi, Is there any way of restricting an Excel user to only selecting entire rows, rather than individual cells?

What I'm ultimately after is allowing the user to only select an entire row, then upon running a macro, the cells within that row are unlocked for individual editing. Running another macro will then return to the original condition of only being able to select entire rows, and individual cells are not editable.

Any ideas?

Thanks.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Something like this:
Code:
[COLOR="Blue"]Private[/COLOR] [COLOR="Blue"]Sub[/COLOR] Worksheet_SelectionChange([COLOR="Blue"]ByVal[/COLOR] Target [COLOR="Blue"]As[/COLOR] Range)
    [COLOR="Blue"]If[/COLOR] Target.Address = Rows(Target.Row).Address [COLOR="Blue"]Then[/COLOR]
        MsgBox "You selected full row"
    [COLOR="Blue"]Else[/COLOR]
        MsgBox "Please, select only full row!"
        [COLOR="Green"]' Additional actions here...[/COLOR]
    [COLOR="Blue"]End[/COLOR] [COLOR="Blue"]If[/COLOR]
[COLOR="Blue"]End[/COLOR] [COLOR="Blue"]Sub[/COLOR]
 
Upvote 0
Thanks, when I try to run this code, assigning Worksheet_SelectionChange to a command button, I get the error:

Compile Error: Argument not Optional

Any ideas?

Thanks.
 
Upvote 0
Done that, but it's still coming up with Argument not Optional. Seems to be based on the (ByVal Target As Range) part of the first line. Sorry, a bit of a newbie at this.
 
Upvote 0
All working now. My error, sorry. Now I need the alert to work within another Macro.

The user would run a macro to copy a line, it would check that they have copied a full row, rather than just a range, and if it's a full row, continue with the copy macro. If it's not a full row, the alert would show.

Is that easy? Thanks for yuor support.
 
Upvote 0

Forum statistics

Threads
1,224,558
Messages
6,179,512
Members
452,920
Latest member
jaspers

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