Last active
October 1, 2015 19:58
-
-
Save nobrinskii/2048654 to your computer and use it in GitHub Desktop.
[vba/excel] 指定された列の、入力された最終行番号を取得する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'------------------------------------------------------------------------------- | |
'指定された列の、入力された最終行番号を取得する | |
'------------------------------------------------------------------------------- | |
'【引数】対象シート、対象の列番号 | |
'【戻り値】列番号 | |
'【備考】シートの下端から上方向に検索して、最初に値が入ったセルの行番号を返す。 | |
Private Function GetLastRowNumber(shtTarget As Worksheet, cnTarget As Integer) As Long | |
Dim rnMax As Long | |
Dim rnInputedLast As Long | |
With shtTarget | |
rnMax = .Cells().Rows.Count | |
rnInputedLast = .Cells(rnMax, cnTarget).End(xlUp).Row | |
End With | |
GetLastRowNumber = rnInputedLast | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment