Databases Reference
In-Depth Information
'Debug.Print "Error Description: "; Error; " - Error Code: "; Err
LastRowinColX = 0
End Function
Function LastColinRowX(Workbook, Worksheet, RowX As Long) As Long
'This function will return the last COLUMN in the Worksheet
of Workbook
On Error GoTo Fix_it:
ActivateWorkbook (Workbook)
Sheets(Worksheet).Activate
Workbooks(Workbook).Worksheets(Worksheet) _
.Range(Cells(RowX, 1), Cells(RowX, Columns.Count))
.Find(What:="*", _
SearchDirection:=xlPrevious,
SearchOrder:=xlByColumns).Activate
LastColinRowX =
FindCol(Selection.Address(ReferenceStyle:=xlR1C1))
Exit Function
Fix_it:
'Debug.Print "Error Description: "; Error; " - Error Code: "; Err
LastColinRowX = 0
End Function
Figure 3.10 shows the Worksheet info sample application in action, where it returns the
maximum row value and the maximum column value for the entire Worksheet, the maximum row
value for any specific column in the active worksheet and the maximum column value for any
specific row in the active Worksheet. The reader can utilize the functions contained in this example
to aid in the construction of their own custom programs that require information pertaining to
specific Worksheet parameters.
FIGURE 3.10 The Worksheet info sample application in action.
Search WWH ::




Custom Search