D
Dave B
I have a workbook with 2 sheets. Both sheets contain a sparce matrix of
data in which the Column Title row and the first column are the only
gauranteed row and column to be filled. I want to select the entire sparse
matrix.
The code below correctly selects the sparse matrix on one sheet, but when I
switch to the 2nd sheet it selects only the 1st row of the matrix.
Any help would be appreciated.
Option Explicit
Dim TopCell, LstRow, LstCol, LstCell, ActiveData As Range
Sub SelActiveData()
Dim NumCol As Integer
ActiveSheet.Select
'
' Selects active data where:
' TopCell is left most cell of column title row
'
NumCol = 14
Set TopCell = ActiveSheet.Range("A2")
Set LstRow = TopCell.End(xlDown)
Set LstCell = LstRow.Offset(0, NumCol)
Set ActiveData = _
ActiveSheet.Range(TopCell.Offset(1, 0), LstCell)
ActiveData.Select
End Sub
data in which the Column Title row and the first column are the only
gauranteed row and column to be filled. I want to select the entire sparse
matrix.
The code below correctly selects the sparse matrix on one sheet, but when I
switch to the 2nd sheet it selects only the 1st row of the matrix.
Any help would be appreciated.
Option Explicit
Dim TopCell, LstRow, LstCol, LstCell, ActiveData As Range
Sub SelActiveData()
Dim NumCol As Integer
ActiveSheet.Select
'
' Selects active data where:
' TopCell is left most cell of column title row
'
NumCol = 14
Set TopCell = ActiveSheet.Range("A2")
Set LstRow = TopCell.End(xlDown)
Set LstCell = LstRow.Offset(0, NumCol)
Set ActiveData = _
ActiveSheet.Range(TopCell.Offset(1, 0), LstCell)
ActiveData.Select
End Sub