ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting Cells (https://www.excelbanter.com/excel-programming/409063-selecting-cells.html)

LRay67

Selecting Cells
 
When a user is in cell K10 (merged cells going to V10) and tabs, I would like
it to go to A15. Anyone know the code behind this. The code below is what I
have stated in ThisWorkbook Code, but still doesn't eliminate the user from
going past K10? Any help would be appreciated. Thanks


Private Sub Workbook_SheetActivate(ByVal sh As Object)
With ActiveSheet
.ScrollArea = "A1:V96"
End With
End Sub


Jason Lepack

Selecting Cells
 
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column 10 Then Set Target =
Target.Worksheet.Cells(Target.Row + 1, 1)
If Target.Row 10 Then Set Target = Target.Worksheet.Cells(1, 1)
Target.Activate
End Sub

This won't let the user enter a cell that is outside the range A1:J10
in the worksheet.

Cheers,
Jason Lepack


All times are GMT +1. The time now is 05:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com