+ Reply to Thread
Results 1 to 7 of 7

VB Macro for variable cell merge into HTML code based on criteria.

  1. #1
    Registered User
    Join Date
    09-19-2009
    Location
    MN, US
    MS-Off Ver
    Excel 2007
    Posts
    12

    VB Macro for variable cell merge into HTML code based on criteria.

    Hi Everyone,

    Does anyone have a VB macro that will copy information from a cell (this will be variable based on criteria) and paste it into the middle of another cell that contains HTML code?

    The criteria for the copy/insert/paste is that the information in the cell that is to be copy/inserted must match up with the correct number (part number).

    I hope this makes sense. I have attached an example spreadsheet. (Pictures are worth 1000 words. ) Hope someone can help. I checked this site and couldn't find anything that was solved that matched the specifics.

    Thank you in advance.
    Attached Files Attached Files
    Last edited by NewYorkVanilla; 10-13-2009 at 08:57 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: VB Macro for variable cell merge into HTML code based on criteria.

    Before going into the VBA - just to check we're on the right tracks...

    Please Login or Register  to view this content.
    does this generate the required results ?

  3. #3
    Registered User
    Join Date
    09-19-2009
    Location
    MN, US
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: VB Macro for variable cell merge into HTML code based on criteria.

    Thank you. It works up to about 100 cells and then doesn't copy any of them to the F column after that. I did change the code to the following because I think it was missing a 1 in the formula.

    Code:
    Please Login or Register  to view this content.
    I have about 8000 cells that have to be looked up and copied so I'm not sure if the $C$100 needs to be changed to 8000?

    Thanks.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: VB Macro for variable cell merge into HTML code based on criteria.

    Re: addition of 1 - correct, my typo.

    Re: 100 rows... yes enlarge the ranges as required (I set to 100 for sake of demo).

  5. #5
    Registered User
    Join Date
    09-19-2009
    Location
    MN, US
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: VB Macro for variable cell merge into HTML code based on criteria.

    Thank you very much for the fast response

    I changed it from 100 to 8000, but I think the formula is not able to hold the information long enough in the array? Not sure if that makes any sense. I have only 4000 items listed in a row that need to be copied in the C and D columns and over 8000 items to lookup in the A and B columns. So the formula is not able to look the A and C columns up after about row 200. (It just copies the B column and removes the <here> when it should be copy/pasting the information in D over to F).

    Hope that makes sense to you.

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: VB Macro for variable cell merge into HTML code based on criteria.

    Hope that makes sense to you
    Not really I'm afraid.

    As I understand it you're saying you have 8000 items listed in A (&B) and 4000 items in C & D where D contains the values to be used in place of <here> where appropriate, correct ?

    Please Login or Register  to view this content.
    The above will only replace the placeholder with text from D if it finds the A value in column C... so if you're not getting results you expect compare the values in A & C accordingly (you may find they're not exactly the same, leading / trailing spaces etc...)

  7. #7
    Registered User
    Join Date
    09-19-2009
    Location
    MN, US
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: VB Macro for variable cell merge into HTML code based on criteria.

    Sorry for the late reply. This worked!!!! I had some formatting issues which were causing vlookup to not work properly. Some of the numbers in my file were text vs. general and some other weird things. Anyway...thank you soooooo much for your help. You rock!

+ 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