Created
May 15, 2013 04:01
-
-
Save stevehenderson/5581574 to your computer and use it in GitHub Desktop.
VBA helper function to find the final column of data on a worksheet (VBA, last, column, find, helper)
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
'A helper function to find the final column of data on a worksheet | |
' | |
'To use, provide the name of the worksheet | |
'The function assumes the data starts in cell A1 | |
'and will return the column number of the column of data | |
' | |
'Author: Steve Henderson [email protected] | |
' | |
Function findLastColumn(sheetName As String) | |
' Find the last column with data | |
Set WS = Worksheets(sheetName) | |
findLastColumn = WS.Cells(1, Application.Columns.Count).End(xlToLeft).Column | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment