frank_m
12-15-2011, 06:09 AM
Attached sample Workbook
The code I'm using to limit the scrolling range is preventing an entire row from being selected.
Is there anyway to re-write it so that I can select a row?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Call LimitScrollArea
End Sub
Private Sub CommandButton1_Click()
Call ResetScrollArea
End Sub
' in a regular module
Sub LimitScrollArea()
Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
.ScrollArea = Range(Cells(1, 1), Cells(LastRow, 19)).Address
End With
End Sub
' in a regular module
Sub ResetScrollArea()
ActiveSheet.ScrollArea = ""
End Sub
Wish I could do something like this
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Call ResetScrollArea
If Not Me.RowButton.Clicked Then' incorrect syntax to demonstrate
Call LimitScrollArea
End If
End Sub
The code I'm using to limit the scrolling range is preventing an entire row from being selected.
Is there anyway to re-write it so that I can select a row?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Call LimitScrollArea
End Sub
Private Sub CommandButton1_Click()
Call ResetScrollArea
End Sub
' in a regular module
Sub LimitScrollArea()
Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
.ScrollArea = Range(Cells(1, 1), Cells(LastRow, 19)).Address
End With
End Sub
' in a regular module
Sub ResetScrollArea()
ActiveSheet.ScrollArea = ""
End Sub
Wish I could do something like this
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Call ResetScrollArea
If Not Me.RowButton.Clicked Then' incorrect syntax to demonstrate
Call LimitScrollArea
End If
End Sub