Excel VBA – 最終行の取得 その1

  • このエントリーをはてなブックマークに追加

最終行の取得方法は、以下のソースコードの通りです。
実践的に、最終行の取得部分は関数化しています。

'メイン
Sub main()

    '最終行の取得
    MsgBox "最終行は" & getMaxRow & "です。"

End Sub

'最終行の取得関数
Function getMaxRow() As Long

    Dim maxRow As Long
    
    '最終行の取得
    maxRow = Sheets("Sheet1").Range("A1").End(xlDown).Row

    '戻り値
    getMaxRow = maxRow

End Function

最終行の取得 その2へ

─────────────── ★
中小企業診断士 かとう
専門は、IT活用による業務改善です。
★───────────────

お勧め:

  • このエントリーをはてなブックマークに追加

関連記事

  1. Excel VBA – CSVファイルをxlsxファ…
  2. Excel VBA – ブックを開く・閉じる(ope…
  3. Excel VBA – パスワード付きZIPファイル…
  4. Excel VBA – 必見!関数の引数をコンパクト…
  5. Excel VBA – 最終行の取得 その2
  6. Excel VBA – 2010 2013 マクロの…
  7. Excel VBA – VBAでHashMapを実現…
  8. Excel VBA – 必見!プログラム関数の探し方のコツ
PAGE TOP