Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-08-2022, 06:49 AM
gmayor's Avatar
gmayor gmayor is offline Help, How to do a Find in a Table, then Shade color? Windows 10 Help, How to do a Find in a Table, then Shade color? Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default


Without access to a sample table, it is difficult to progress this further. The code looks for cell content that is Bold and coloured red or green. Highlight is not the issue so much as the search criteria.
Can you link an example document?
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #2  
Old 01-09-2022, 12:11 AM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Help, How to do a Find in a Table, then Shade color? Windows 10 Help, How to do a Find in a Table, then Shade color? Office 2019
Competent Performer
Help, How to do a Find in a Table, then Shade color?
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 200
Cendrinne is on a distinguished road
Default I don't know how to create a link to have you see the doc....

Hi Graham,
As I've mentioned previously, I don't know how to create a link to have you access to a sample of a document yet. Besides, I would have to do it with my own computer.

Good news though I found a way to do it as a regular find and replace, by creating a Cell Style. And thank god, it didn't touch the Font Color nor the Highlighted Text, nor the Bold Font.

I can share my script, however, I don't now how to share my style.

But what I've done, is Select a Table Cell, and put it with the color of my choice, then instead of asking to Apply this to the Whole Table, I've requested to Apply it to the Top Left Cell, just as the image with the first table with a Red colored circle, from the link below:

Workaround for styles with table cells in Word - Office Watch

And here is my code script:

Code:
Sub FNR_TXT_Selec_Cell_Put_Colr_Orange()

    Selection.Find.ClearFormatting
    Selection.Find.Highlight = True
    With Selection.Find.Font
        .Bold = True
        .Color = 5287936                        'Green
    End With
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Style = ActiveDocument.Styles( _
        "Cell Colr Org para")
    With Selection.Find
        .Text = "&"
        .Replacement.Text = "^&"
        .Forward = True
        .Wrap = wdFindStop
        .Format = True
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub
I can't yet code like Pro's and I don't know why your code on my side, didn't do what it was intended to do, but I found a way to accomplish my need. The Green color code, well, it's numbers, that is because I've recorded my steps, and it gave me that number code. I guess I would have to create one for the red one. Unless I try to encorporate part of your script to do ''or''. I'll try later.

Just glad, this script works for my need. I do thank you for helping me though. It's really really great of you

Happy New Year my friend

Cendrinne
Attached Files
File Type: docx tst a macro3.docx (45.2 KB, 8 views)

Last edited by Cendrinne; 01-09-2022 at 05:14 PM. Reason: uploaded the word document
Reply With Quote
Reply

Tags
macro help, shade a cell, word table macro



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help, How to do a Find in a Table, then Shade color? Conditionally Shade Table Cells S7ewie Mail Merge 8 04-29-2021 01:52 AM
Macro to change an RGB table cell shading color to another RGB color David Matthews Word VBA 4 05-29-2018 02:45 PM
Help, How to do a Find in a Table, then Shade color? Code to find a named (bookmarked?) table, replicate a row or table, and delete a specified table. kevinbradley57 Word VBA 9 09-21-2017 04:58 PM
Help, How to do a Find in a Table, then Shade color? Text area in table won't shade LSHAW Word Tables 1 03-09-2017 03:08 PM
Help, How to do a Find in a Table, then Shade color? VBA Table – Search All Tables - Find & Replace Text in Table Cell With Specific Background Color jc491 Word VBA 8 09-30-2015 06:10 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:22 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft