VBA – 计算连续填充单元格的数量
以下是我的代码到目前为止。 有小费吗?
With wSheet colCount = .Range(1 & .Columns.Count).End(xlToRight).Column End With
我究竟做错了什么?
尝试:
colCount = wSheet.UsedRange.Rows(1).Columns.Count
(修订版)
要获得最右边的填充列的编号:
colCount = .Cells(1, .Columns.Count).End(xlToLeft).Column
要获得非空白单元格的计数,正如你的标题所示:
Application.WorksheetFunction.CountA(.Rows(1).EntireRow.Cells)