作者:绿色风
分类:
时间:2022-08-18
浏览:101
楼主 xyh9999 |
Function cGetRealLastCell(cBookName, cSheetName) 'LiQiuCai:返回→"|实际最大行|实际最大列|Used最大行|Used最大列" '? cGetRealLastCell("book1.xls", "sheet1") '例子 '10|5|19|7 '返回值
- Dim lRealLastRow As Long
- Dim lRealLastColumn As Long
- On Error Resume Next
- lRealLastRow = Workbooks(cBookName).Sheets(cSheetName).Cells.Find(What:="*", After:=Workbooks(cBookName).Sheets(cSheetName).Range("A1"), _
- LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:= _
- False, MatchByte:=False, SearchFormat:=False).Row
- lRealLastColumn = Workbooks(cBookName).Sheets(cSheetName).Cells.Find(What:="*", After:=Workbooks(cBookName).Sheets(cSheetName).Range("A1"), _
- LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious, MatchCase:= _
- False, MatchByte:=False, SearchFormat:=False).Column
- cGetRealLastCell = lRealLastRow & "|" & lRealLastColumn & "|" & Workbooks(cBookName).Sheets(cSheetName).UsedRange.Rows.Count & "|" & _
- Workbooks(cBookName).Sheets(cSheetName).UsedRange.Columns.Count
- On Error GoTo 0
- If cGetRealLastCell = "" Then
- cGetRealLastCell = "||||"
- End If
- End Function
|
2楼 rongjun |
学习了 |
免责声明
有感于原ExcelTip.Net留存知识的价值及部分知识具有的时间限定性因素,
经与ExcelTip.Net站长Apolloh商议并征得其同意,
现将原属ExcelTip.Net的知识帖采集资料于本站点进行展示,
供有需要的人士查询使用,也慰缅曾经的论坛时代。
所示各个帖子的原作者如对版权有异议,
可与本人沟通提出,或于本站点留言,我们会尽快处理。
在此,感谢ExcelTip.Net站长Apolloh的支持,感谢本站点所有人**绿色风(QQ:79664738)**的支持与奉献,特此鸣谢!
------本人网名**KevinChengCW(QQ:1210618015)**原ExcelTip.Net总版主之一