S
SaeOngJeeMa
Hi, I have two questions:
1) Is there a way to store a Range in public variable an have it's scope and
lifetime last until the workbook is closed? I'm trying to use the code below
but the Range information is being lost.
2) Is there a way to set the range with having to activate the worksheet and
select the cells?
Thanks,
Dean
****************************
In the General Declarations section of one of my code modules:
Public grngFSF As Range
Sub in one of my code modules that runs on the ThisWorkbook Open event and
also gets run again when rows of the worksheet are added or removed:
Public Sub setWorksheetDataRanges()
On Error GoTo Err_setWorksheetDataRanges
With Worksheets("FSF")
.Activate
.Range(Cells(5, 1), ActiveCell.SpecialCells(xlLastCell)).Select
Set grngFSF = Selection
Cells(5, 1).Select
End With
Exit_setWorksheetDataRanges:
Exit Sub
Err_setWorksheetDataRanges:
MsgBox "sub setWorksheetDataRanges " & Err.Description
Resume Exit_setWorksheetDataRanges
End Sub
1) Is there a way to store a Range in public variable an have it's scope and
lifetime last until the workbook is closed? I'm trying to use the code below
but the Range information is being lost.
2) Is there a way to set the range with having to activate the worksheet and
select the cells?
Thanks,
Dean
****************************
In the General Declarations section of one of my code modules:
Public grngFSF As Range
Sub in one of my code modules that runs on the ThisWorkbook Open event and
also gets run again when rows of the worksheet are added or removed:
Public Sub setWorksheetDataRanges()
On Error GoTo Err_setWorksheetDataRanges
With Worksheets("FSF")
.Activate
.Range(Cells(5, 1), ActiveCell.SpecialCells(xlLastCell)).Select
Set grngFSF = Selection
Cells(5, 1).Select
End With
Exit_setWorksheetDataRanges:
Exit Sub
Err_setWorksheetDataRanges:
MsgBox "sub setWorksheetDataRanges " & Err.Description
Resume Exit_setWorksheetDataRanges
End Sub