![]() |
|
#4
|
||||
|
||||
|
You could use code like:
Code:
Sub DeleteTextFromColoredCells()
Application.ScreenUpdating = False
Dim myTable As Table, myCell As Cell
Dim CurrentTexture As Long
Dim CurrentForegroundPatternColor As Long
Dim CurrentBackgroundPatternColor As Long
If Not Selection.Information(wdWithInTable) Then
MsgBox "Place the cursor in a table cell with a colored pattern."
Exit Sub
End If
With Selection.Range.Cells(1).Shading
CurrentTexture = .Texture
CurrentForegroundPatternColor = .ForegroundPatternColor
CurrentBackgroundPatternColor = .BackgroundPatternColor
End With
For Each myTable In ActiveDocument.Tables
For Each myCell In myTable.Range.Cells
With myCell
If .Shading.Texture = CurrentTexture Then
If .Shading.ForegroundPatternColor = CurrentForegroundPatternColor Then
If .Shading.BackgroundPatternColor = CurrentBackgroundPatternColor Then
.Range.Text = ""
End If
End If
End If
End With
Next myCell
Next myTable
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
| Tags |
| clearcontents, vba |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Delete specific text
|
Jackson | Word VBA | 16 | 12-06-2019 08:24 PM |
Macro to delete text in specific styles
|
ljd108 | Word VBA | 14 | 01-22-2019 01:22 PM |
Delete cell content that has a specific format
|
Daniel Arbeit | Excel Programming | 1 | 06-20-2016 03:02 PM |
Delete specific mass text on document
|
JadeRisley | Word | 4 | 07-17-2013 11:11 PM |
Macro to delete rows with all empty cells
|
ubns | Excel Programming | 2 | 08-14-2012 02:01 AM |