Example:
A B C D E F
3 4 5 6 7 8
I need a vba code that will look in the 2nd row for a specific value and return that column's letter. For example, searching the row for 7 would return "E".
How can I do this?
Example:
A B C D E F
3 4 5 6 7 8
I need a vba code that will look in the 2nd row for a specific value and return that column's letter. For example, searching the row for 7 would return "E".
How can I do this?
Assuming that you have "Headers" in Row 1
This will return what you want
where H2 has the value you are looking upPlease Login or Register to view this content.
If you have no header
where H2 has the value you are looking upPlease Login or Register to view this content.
Hope this helps
If you need any more information, please feel free to ask.
However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....
Also
اس کی مدد کرتا ہے اگر
شکریہ کہنے کے لئے سٹار کلک کریں
If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.
Hi,
You don't actually need VBA for this you could use standard Excel functions.
If the result will always be between columns A-Z then:
otherwisePlease Login or Register to view this content.
it might be advisable to use a variable cell to hold the number 7, or whatever and substitute the cell address for '7' in the formula.Please Login or Register to view this content.
Rgds
Richard Buttrey
RIP - d. 06/10/2022
If any of the responses have helped then please consider rating them by clicking the small star icon below the post.
Thanks for the responses. The columns do go past Z, all the way to AP. This is part of a much larger macro. Essentially, the user inputs an even integer (ex. 40) and then I need to search for that number in a row. Once I have the row, I need to make a chart with an array of data starting in that column. This is what I have so far:
First off, the L1 cell that is searching for the formula ends up showing just a 0 instead of a letter.Please Login or Register to view this content.
It feels like there should be an easier way to do this in the code rather than putting a formula into a cell and extracting that cell's value.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks