+ Reply to Thread
Results 1 to 5 of 5

Loop through range and get column header for each cell containing a value

  1. #1
    Registered User
    Join Date
    12-10-2014
    Location
    United States
    MS-Off Ver
    14.0.7015.1000
    Posts
    3

    Loop through range and get column header for each cell containing a value

    I need to loop through each column starting at E2 to the last used column and get the column header of each cell that contains a value. Attached is the spreadsheet I am working with just in case my explanation isn't clear.

    I do a lot of my work in Access VBA so I'm a newb when it comes to Excel. I am totally stumped on how to do this, so any suggestions is greatly appreciated!
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Loop through range and get column header for each cell containing a value

    Please Login or Register  to view this content.
    Last edited by protonLeah; 12-10-2014 at 04:29 PM.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    12-10-2014
    Location
    United States
    MS-Off Ver
    14.0.7015.1000
    Posts
    3

    Re: Loop through range and get column header for each cell containing a value

    Thanks for the quick reply protonLeah! I apologize for the delayed reply.

    The document names obtained for each job title can go on the following sheet. One column will hold the job title, and the following column should hold all of the document names obtained that is related to the job title. What event is this sub procedure called? I see that Excel's vba event procedures are almost completely different than Access events.

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Loop through range and get column header for each cell containing a value

    This macro is not an event macro and goes in a standard module to be run manually from the VBE or maybe a button on "sheet1".
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    12-10-2014
    Location
    United States
    MS-Off Ver
    14.0.7015.1000
    Posts
    3

    Re: Loop through range and get column header for each cell containing a value

    Sorry for the late reply, protonLeah. Thank you for the explanation of the code and how it works. I was making it a lot harder than it actually is. I barely do any development in Excel so the ranges and functions are totally new to me. Do you know of any good Excel books or online tutorials (preferably free) that I can take to get a better understanding of development in Excel?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Copy single cell to range in different column loop
    By carlwin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-19-2014, 11:26 PM
  2. Return Column Header for Cell Range that equals "1"
    By kibbles in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-11-2013, 11:10 AM
  3. Replies: 1
    Last Post: 10-05-2013, 03:35 PM
  4. Replies: 12
    Last Post: 09-21-2012, 12:22 PM
  5. Loop through column headers to search from column name and get cell range
    By Pie in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-28-2005, 08:20 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1