Find column based on header name, then go to the column in the current row...

sadams1

Board Regular
Joined
Aug 19, 2006
Messages
219
This is based on a previous post & wasn't sure if I should start a new post or reopen the previous thread so I started new...if this is wrong, please let me know.




Anyhow, this code works great & I'd like to see if it can be updated so the active cell goes to the column header found & in the current row.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
You didn't mark any of the suggestions as the solution so I am unclear on which one you ended up running with.
Assuming it was @jolivanes version, see if this is what you had in mind.

VBA Code:
Sub TestActivate()
    Dim msg As String
    msg = InputBox(Prompt:="What is the Header?", Title:="Find Column")
    Cells(ActiveCell.Row, Rows(1).Find(msg, , , 1).Column).Activate
End Sub
 
Upvote 0
Solution
hello Alex,
This is AMAZING! I can't believe how simple you made this look...I figured it was going to be a hornet's nest of fun. Thank you very much & I greatly appreciate your time.
Steve
 
Upvote 0
OK...I've torn enough hair out to come crawling back for help...this code has been used frequently every day & is huge help. Suddenly, today the keyboard shortcut I set up stopped working. It works manually by going to "Macro" in the menu but am at a loss as to why the shortcut just stopped. Could it be that the format in the header row has to be the same all the across the row? That's the only thing I can think of because, here's the kicker, a backup of the same workbook from a few days ago STILL WORKS WITH THE SHORTCUT. I've deleted the macro & remade it with the same shortcut combination "Ctrl Shift B" & it does nothing. I've redone it with different keyboard shortcuts & nothing. It works manually. Any insights that I'm missing? Thank you again for this amazing code!
Steve
 
Upvote 0
If you are not seeing the message box appear then it can't have anything to do with the format in the header.
Do you have code that runs before that code ?
If you put another macro in that workbook and give it a shortcut key does it run ?
 
Upvote 0
Attached is a screenshot of the macro...it's the code copied from your post & been working great until yesterday.
What's confusing is that other macro's using the "Ctrl Shift" shortcut work OK & that it works when running it manually thru the menu bar "Macros"
I redid the macro with a shortcut this morning using the "Ctrl Shift" & "Ctrl" & the message box doesn't appear...it's the damndest thing.
 

Attachments

  • Screenshot 2024-04-22 055406.png
    Screenshot 2024-04-22 055406.png
    38.9 KB · Views: 2
Upvote 0
Oddly enough, after posting the last thread, I thought "what happens if the Module from the workbook that works is importing into the current workbook where it doesn't?" & just like that, IT WORKED!? Sorry to bother you about this & especially for not doing the import long before now.
 
Upvote 0

Forum statistics

Threads
1,215,504
Messages
6,125,183
Members
449,212
Latest member
kenmaldonado

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top