Public Function FindColumn(ByVal needle As String, Optional mySheet As String, Optional myPart As Boolean) As Integer ' This function will return the number of the first column containing the passed ' string on the passed sheet. ' The third (optional) parameter specifies if the search string should matched ' part or all of the string to be found. If omitted the whole string is searched for. ' If no sheetname is passed the default of "Dashboard" will be used. ' If no string is found the result will be 0 If IsMissing(mySheet) Then mySheet = "Dashboard" If mySheet = "" Then mySheet = "Dashboard" If IsMissing(myPart) Then myPart = False If myPart = True Then lookat = xlPart Else lookat = xlWhole End If FindColumn = 0 Dim vFindit As Variant If WorksheetExtant(mySheet) Then With ThisWorkbook.Worksheets(mySheet) Set vFindit = .Cells.Find(What:=needle, LookIn:=xlValues, lookat:=lookat) If vFindit Is Nothing Then MsgBox "FindColumn : Unable to find " & needle & " on sheet " & mySheet, vbCritical Exit Function End If FindColumn = vFindit.Column End With Else MsgBox "FindColumn : Unable to find Worksheet " & mySheet, vbCritical End If End Function