+ Reply to Thread
Results 1 to 3 of 3

Automatically filling comment boxes

  1. #1
    Registered User
    Join Date
    10-05-2007
    Posts
    15

    Automatically filling comment boxes

    I have a workbook that I'm trying to create comment boxes automatically for the cells in column A. There is an associated text file that holds all the verbage for the comments and each comment has a heading that easily relates to the cell in column A. For example, if cell in column A said "A. First Order" then the text file would have:

    A. First Order
    1. The first order of business..,

    where the comment falls on the line or lines after the heading. This is the code that I have so far to try and do this:

    Please Login or Register  to view this content.
    I just have messageboxes now so I can track the progress of the code, but I'll add the actual format/add commentbox code later.

    My issue is I either get infinite loops or a loop that correctly identifies commentbox text the first time only and no time after that.

    The idea is to look at the line read from the file and compare it to the text in column A. If its a match, it starts reading in the next line(s) from the file until it gets to a line that matches (contains) text from the next cell down in Column A. This is the main problem because I have to read in the line before I compare it and with the code I have now, when I restart the loop I read in the next line of the file, which will never match anything in column A, because its a comment line.

    I want to automate this process because a) its a long file b)its the first revision which means adds/removals and verbage changes later c)I have to do it to two sheets in the workbook. I've attached a snippet of the xls and txt files.

    I'm open to any suggestions (case statements, complete re-code, etc) because I've only been using VBA about a week so its all pretty new. Thanks for your help.
    Attached Files Attached Files

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello VitoHGrind,

    I would place a special character at then end of each comment. A character like an asterisk (*). This will help stop the endless looping by checking for this character rather than the beginning of the next comment line.

    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    10-05-2007
    Posts
    15
    Hi Leith Ross,

    I thought about something like that before and decided against it because a)The Guidelines (comment) file is updated in a separate process and not by myself and b) that means someone would have to manually add all of the "*"s to the end of each comment in this version and subsequent revisions after I hand it off.

    I kind of want to just assimilate this into the process with out changing too much.

    Is there anything else I could do?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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