#1
|
|||
|
|||
Macro to find a header based on a value in another cell
I'm looking for some help writing a vba macro to find header with a name that is equal to another cell, then copy the entire column to a new column to the right. The value I want to find will be in the header row in cells (F2-Q2) and the value I am looking for can be found in cell V1. Once the header is found, copy the entire column and paste in column AG.
I've attached an example worksheet. I appreciate any help you can provide! |
#2
|
||||
|
||||
Code:
Sub blah() Columns(Application.Match(Range("V1").Value2, Rows(2), 0)).Copy Columns("AG") End Sub |
#3
|
|||
|
|||
Worked perfectly, thanks!
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to select cell based on formula | mreynolds1775 | Excel Programming | 4 | 09-22-2017 12:13 PM |
Macro- find and replace from preselected options based on frequency (like an Ad libs) | blondie | Word VBA | 0 | 02-27-2017 01:41 PM |
Can anyone here tweek this macro for renaming Excel files based on a cell's contents? | chrisd2000 | Excel Programming | 6 | 07-01-2014 01:53 PM |
Word VBA Macro to Find and Replace based on the Alt Text of an Image | bennymc | Word VBA | 1 | 01-27-2014 04:23 PM |
Macro based on cell value | ubns | Excel Programming | 1 | 05-07-2012 04:03 AM |