how to confine the range of movement of cursor

S

starwil

for example, if i just want to let the cursor in worksheet move from column
A to V and / or row 1 to 50,
how to setup?
 
B

Bob Phillips

Here is some VBA top do it

Dim oldCell As Range

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Row > 50 Or Target.Column > 22 Then
If Not oldCell Is Nothing Then
oldCell.Activate
Else
Me.Range("A1").Activate
End If
Else
Set oldCell = Target
End If
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
S

starwil

thanks for reply,
how to activate the VBA,
if not use VBA, excel have function key to do that?
 
T

Thomas Ramel

Grüezi starwil

starwil schrieb am 24.05.2004
for example, if i just want to let the cursor in worksheet move from column
A to V and / or row 1 to 50,
how to setup?

Just hide the non-used cells/rows.

--
Regards

Thomas Ramel
- MVP for Microsoft-Excel -

[Win XP Pro SP-1 / xl2000 SP-3]
 
S

starwil

i know this function, i just want to lock the scrolling and movement of
cursor after certain column, and keep the cell unhide, so hide some cells is
not suitable.....

Thomas Ramel said:
Grüezi starwil

starwil schrieb am 24.05.2004
for example, if i just want to let the cursor in worksheet move from column
A to V and / or row 1 to 50,
how to setup?

Just hide the non-used cells/rows.

--
Regards

Thomas Ramel
- MVP for Microsoft-Excel -

[Win XP Pro SP-1 / xl2000 SP-3]
 
C

Chip Pearson

You can use the ScrollArea property of the Worksheet to restrict
the user to a range of cells. E.g.,

ActiveSheet.ScrollArea = "$A$1:$G$10"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


starwil said:
i know this function, i just want to lock the scrolling and movement of
cursor after certain column, and keep the cell unhide, so hide some cells is
not suitable.....

Thomas Ramel said:
Grüezi starwil

starwil schrieb am 24.05.2004
move from
column
A to V and / or row 1 to 50,
how to setup?

Just hide the non-used cells/rows.

--
Regards

Thomas Ramel
- MVP for Microsoft-Excel -

[Win XP Pro SP-1 / xl2000 SP-3]
 
S

starwil

but i don't want to use VBA
i just want to know whether this is function key in excel
Chip Pearson said:
You can use the ScrollArea property of the Worksheet to restrict
the user to a range of cells. E.g.,

ActiveSheet.ScrollArea = "$A$1:$G$10"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


starwil said:
i know this function, i just want to lock the scrolling and movement of
cursor after certain column, and keep the cell unhide, so hide some cells is
not suitable.....

Thomas Ramel said:
Grüezi starwil

starwil schrieb am 24.05.2004

for example, if i just want to let the cursor in worksheet
move from
column
A to V and / or row 1 to 50,
how to setup?

Just hide the non-used cells/rows.

--
Regards

Thomas Ramel
- MVP for Microsoft-Excel -

[Win XP Pro SP-1 / xl2000 SP-3]
 
Top