1
我試圖創建一個用戶定義的函數來計算在列A中使用的細胞數量,然後通過10自定義函數計算所用的細胞數在一列在Excel 2010
多個這種不幸的是, UDF是一個完全不同於我通常放在一起的宏的編碼野獸。
Function UsedCells() As Long
n = Worksheets("Marginal").Range("A:A").Cells.SpecialCells(xlCellTypeConstants).Count
y = n * 10
End Function
這不起作用 - 任何人都提供幫助嗎?謝謝!
編輯編輯 此代碼結束了工作基礎上的聖誕代碼:
Function UsedCells(Col As String) As Long
n = Range("A" & Rows.Count).End(xlUp).Row
UsedCells = n * 10
End Function
對不起通過你的意思困惑?你的意思是什麼 – user3682157 2014-12-04 21:33:34
函數'UsedCells'的名字是變量。我正在添加更多的細節以使它對您更有用。 – Chrismas007 2014-12-04 21:34:20
添加了替代方法。增加了更多細節。 – Chrismas007 2014-12-04 21:38:01