+ Reply to Thread
Results 1 to 3 of 3

VBA to find red font, then find black font & paste that value next to the red font

  1. #1
    Registered User
    Join Date
    01-06-2012
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2010, Excel 365
    Posts
    47

    VBA to find red font, then find black font & paste that value next to the red font

    I have a list of serial numbers for farm and construction machines. Some serial numbers are black and some are red. The black indicate a parent machine and the red indicate an attached machine. (Note: There can be several attachments on 1 parent machine.)

    Example:
    456789 (tractor SN)
    987312 (loader SN)


    I want to have a macro that would find any cell where the font is red (an attachment). Then it would look at the previous cells until it found one that had black font (the parent). It would copy the serial number of the parent and paste it in the cell just to the right of the attachment. So it would end up looking like this (if this was a spreadsheet):

    456789 (tractor SN)
    987312 (loader SN) 456789 (tractor SN)


    Any ideas?

    UPDATE:
    I was able to get this code to work, but it only looks at the 2 previous cells to see if the font is black or not. I would need it to continue looking until it got to black font...

    Please Login or Register  to view this content.
    Last edited by Lewej23; 03-21-2016 at 04:54 PM.

  2. #2
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: VBA to find red font, then find black font & paste that value next to the red font

    Try this one:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-06-2012
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2010, Excel 365
    Posts
    47

    Re: VBA to find red font, then find black font & paste that value next to the red font

    That works perfectly! Thank-you for your help!

+ 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. Setting a substitute font for a VBA created Email if recipient doesn't have the body font
    By WiliamsRenault in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-25-2014, 05:10 AM
  2. Replies: 15
    Last Post: 05-31-2012, 10:34 AM
  3. Macro to convert several font sizes to another font size - with an exception
    By ddd in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-08-2012, 05:17 PM
  4. Replies: 3
    Last Post: 07-06-2011, 01:30 PM
  5. Replies: 5
    Last Post: 04-22-2011, 10:21 AM
  6. Print colour font, outcome was black font
    By Danielexcel2009 in forum Excel General
    Replies: 2
    Last Post: 06-01-2009, 02:05 AM
  7. Dropdown list for font size, font type and number formats
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-09-2005, 01:06 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