+ Reply to Thread
Results 1 to 4 of 4

Dynamic tables, search if table header exists and if not, give message

  1. #1
    Forum Contributor
    Join Date
    05-28-2020
    Location
    Poland
    MS-Off Ver
    O365,
    Posts
    120

    Dynamic tables, search if table header exists and if not, give message

    Good morning,

    I am trying to figure out, how I can Loop through a table
    table header and check, if a header name exists and if not, give out a message.

    One of the challenges is, that the table is generated through a converter and the
    list imported (CSV) can be different, can be 5, 10 or even columns, so it is dynamic.
    Importing and converting to a table is no issue.

    but

    For example:
    If I have a table with house styles and I would like to check

    houses.png

    if there is Tudor, Farmhouse & Cottage in the header

    could i do that with a "do until loop"?

    something like:

    Please Login or Register  to view this content.
    Where my logic has left me, if I try to loop through each header, as soon as the header is found, it should stop and go
    to search for the next name, in my case "Farmhouse" and if it does not exist, I would like to inform the user, that
    the specific header is not found and therefore I have to leave the loop, not sure how to do it in such combination.

    How would I do that, is there are more sophisticated way compared to may amateur approach? I could run multiple loops
    but I am sure, there is a much better and faster way, try to keep the code as slim as possible.

    thank you for the help,

    Mike

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Dynamic tables, search if table header exists and if not, give message

    Not sure what you are actually wanting to do when found but this will give you an idea...
    Please Login or Register  to view this content.
    Last edited by sintek; 06-08-2023 at 04:16 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Forum Contributor
    Join Date
    05-28-2020
    Location
    Poland
    MS-Off Ver
    O365,
    Posts
    120

    Re: Dynamic tables, search if table header exists and if not, give message

    Dear SinTek

    thank you for helping me out and sorry for my bad explanation.

    I need to check, if the header exists and if it doesn't, then I will show a msgbox to the user explaining,
    which column is missing, because I won't be able to continue with the macro, I need the specific columns
    for some further work and therefore the example.

    COOL, your code works perfectly...

    thank you so much for the help, this is exactly, what I was looking for !!!

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Dynamic tables, search if table header exists and if not, give message

    Glad to have helped...Tx for rep +

+ 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. Replies: 3
    Last Post: 08-14-2021, 05:25 PM
  2. lookup value in a named range (table) and give header information as result
    By cmmchick in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-05-2019, 09:18 AM
  3. [SOLVED] Search nearest value above in table. return header row + header column
    By 323428 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-22-2018, 05:06 AM
  4. Error message: A query with the name 'Table 2' already exists
    By DoriAdi in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-28-2018, 07:40 PM
  5. Macro to display a message box if specific text exists in a table
    By estewart423 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-14-2017, 05:39 PM
  6. [SOLVED] Run Message Box When Header in Table is Changed (VBA Code)
    By Stryker152 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-19-2014, 02:23 AM
  7. [SOLVED] Match a value in a table and print the header of that column if value exists
    By norms in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-25-2013, 06:48 PM

Tags for this Thread

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