diff --git a/README.md b/README.md index ec6a7e4..f2dba7c 100644 --- a/README.md +++ b/README.md @@ -315,6 +315,20 @@ Parse UTC date to local date.
+## Last Row +Returns the last used row number for a given column. + +**Required Functions**: +1. `common.getColumnLetter` + +**Input**: +1. `String` Worksheet Name _(ex. "Sheet 1")_ +2. `String` Search Column _(ex. "A:A")_ + +**Output**: `Long` Last Row Number + +
+ ## Levenshtein Distance (String Metric) This function takes two strings of any length and calculates the Levenshtein Distance between them. Levenshtein Distance measures how close two strings are by checking how many Insertions, Deletions, or Substitutions are needed to turn one string into the other. Lower numbers mean the strings are closer than high numbers. Unlike Hamming Distance, Levenshtein Distance works for strings of any length and includes 2 more operations. However, calculation time will be slower than Hamming Distance for same length strings, so if you know the two strings are the same length, its preferred to use Hamming Distance. diff --git a/lastRow.bas b/lastRow.bas new file mode 100644 index 0000000..e64e672 --- /dev/null +++ b/lastRow.bas @@ -0,0 +1,19 @@ +''''''''''''''''''''''''''''''''''''''''''''''' +' Get Last Row In Column ' +''''''''''''''''''''''''''''''''''''''''''''''' +' *** Requires Function "getColumnLetter" *** + +'recieves input of worksheet (ex. "Sheet 1") and column range (ex. "A:A") as string +'outputs last used row number as long + +Function lastRow(searchWorksheet As String, searchColumn As String) As Long + 'dimension variables + Dim wb As Workbook: Set wb = ThisWorkbook + Dim ws As Worksheet: Set ws = wb.Sheets(searchWorksheet) + + 'find the column letter of the search column + Dim searchColumnLetter As String: searchColumnLetter = common.getColumnLetter(ws.Range(searchColumn).Column) + + 'find and return the last row in the search column + lastRow = ws.Range(searchColumnLetter & Rows.Count).End(xlUp).Row +End Function