I am new to Macros/VBAs and am trying to edit something my predecessor built out. Essentially, I have a report from a CRM that exports 9 fields and then does a complex re-sorting. I want to replace one of those 9 fields (a numeric field called "Sort Priority") with a text field called "Course Session". I think I have pinpointed where in the Macro it needs to be updated but have tried everything I can think of and can't figure out how to get it to properly update.
Thanks in advance.
Here is the code as is (I tried replacing the "Sort Priority" with "Course Session" and changing what I thought were integer functions to string but nothing worked). Can't figure out what I am missing...
Function FindQAReportStartColumn() As String
For Each cell In ThisWorkbook.Worksheets("INPUT").Range("B1:B50")
If InStr(1, CStr(cell.Value), "Sort Priority") > 0 Then
FindQAReportStartColumn = cell.address
Exit Function
End If
Next cell
FindQAReportStartColumn = ""
End Function
You could just search the sheet for that string
Function FindQAReportStartColumn() As String
Dim rng As Range
With ThisWorkbook.Worksheets("INPUT").Cells
Set rng = .Find("Course Session", LookIn:=xlValues, lookat:=xlPart, _
MatchCase:=False)
If rng Is Nothing Then
FindQAReportStartColumn = ""
Else
FindQAReportStartColumn = rng.Address
End If
End With
End Function