Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
以下是我到目前为止的代码。有小费吗?
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)