如何使用vba在工作表中找到最后一个可见列(而不是隐藏列)?
我使用了以下代码:
Dim LastColumn As Integer
If WorksheetFunction.CountA(Cells) > 0 Then
            'Search for any entry, by searching backwards by Columns.
LastColumn = Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
MsgBox LastColumn
End If但它给了我最后一个列号。我要最后一个可见的列号。有什么帮助吗?
发布于 2016-04-15 01:09:46
试试下面的。可以使用xlCellTypeVisible指定隐藏单元格和非隐藏单元格。
Sub counthidden()
MsgBox ActiveSheet.UsedRange.SpecialCells(xlCellTypeVisible).Columns.Count
End Subhttps://stackoverflow.com/questions/36636589
复制相似问题