Hello, I'm trying to build a macro that can automatically look at a state abbreviated ID (TX, KS, NY, etc.) in a single column and return the full state name (Texas, Kansas, New York, etc.) in a blank column to the right. I need to be able to use this macro in any workbook, as I will refer to various reports containing state and county data. It's important to note that WHERE the State ID appears could be different on any given report. So in one report, the column containing the state ID might appear in column B, but in a different report it could appear in column D. Similarly, the data set and column headers might start on row 1 or row 4. So that's constantly changing. I have a Helper Table already set up with column A listing the state IDs and column B listing the state names, and in the past I would just use a Vlookup function to get the state name, then copy the formula down to the last populated row. But I would really like to be able to run a macro that will automatically search my active worksheet for a cell containing the column header "State ID" (for simplicity purposes let's say it's in cell A1), I would like it to insert a blank column to the right (so column B is empty), give it a column header name of "State Name", then go through each populated row looking at the state ID in column A and returning the state name in column B until it gets to the bottom of the report.
So the report I'm working in could look like this...
(A) (B)
(1) State ID County
(2) AL Bibb
(3) AL Calhoun
(4) AL Chilton
(5) AR Carroll
(6) AR Clay
(7) AZ Apache
(8) CA Kern
I'd like to run a macro and end with the report looking like this...
(A) (B) (C)
(1) State ID State Name County
(2) AL Alabama Bibb
(3) AL Alabama Calhoun
(4) AL Alabama Chilton
(5) AR Arkansas Carroll
(6) AR Arkansas Clay
(7) AZ Arizona Apache
(8) CA California Kern
Any help would be greatly appreciated!!! Thank you!!!
So the report I'm working in could look like this...
(A) (B)
(1) State ID County
(2) AL Bibb
(3) AL Calhoun
(4) AL Chilton
(5) AR Carroll
(6) AR Clay
(7) AZ Apache
(8) CA Kern
I'd like to run a macro and end with the report looking like this...
(A) (B) (C)
(1) State ID State Name County
(2) AL Alabama Bibb
(3) AL Alabama Calhoun
(4) AL Alabama Chilton
(5) AR Arkansas Carroll
(6) AR Arkansas Clay
(7) AZ Arizona Apache
(8) CA California Kern
Any help would be greatly appreciated!!! Thank you!!!