I was working on an Excel project with multiple Tabs. One of the worksheets has a column called "Names". My users usually move the columns every now and then. So to extract the correct column I have used this particular VBA code.
HEADER = Sheets("WORKSHEET").Range("A1:Z1").Address
SourceDataColumn = Application.WorksheetFunction.Match("Name", HEADER, 0)
SourceColumnLetter = Split(Cells(1, SourceDataColumn).Address(True, False), "$")(0)
Example: In this case, the output would be [ SourceColumnLetter = C ] containing the "Names"
It works fine, I was just wondering if there is a way to set the 'SourceColumnLetter' as a global variable so that I don't have to use the same whole block of code again and again.
Any help would be appreciated. Thanks in Advance.

Sheet3.UsedRange.Columns.Count(whereSheet3is the sheet you want to track) inWorksheet_Changeevent. If the column number changes, call the macro to resetSourceColumnLetter