![]() |
|
#5
|
|||
|
|||
|
The problem is I need to use it in Word doc and not convert it to others. Data came from Crystal by the way.
Thi sis what I have but what I need is to remove lines that have "No Color" but with zero values. If they have 1 or other values, i should not be removed. Also, as I've said i it has next row(s) data, it should be removed as well BUT only with zero values. What I have is this only for No Color: Code:
'Remove the No Color line
Sub NoCorrelateRemove()
Dim lineRange As Range
Dim searchRange As Range
'Search the entire document
Set searchRange = ActiveDocument.Content
Do
'Find the No Color line
With searchRange.Find
.ClearFormatting
.Wrap = wdFindStop
.Forward = True
.Text = "No Color"
.Execute
If Not .Found Then
Exit Do
End If
End With
'create a range that covers this entire line
Set lineRange = ActiveDocument.Range(searchRange.Start = 1, searchRange.End = 5)
lineRange.Expand wdParagraph
lineRange.Delete
Loop
End Sub
Last edited by macropod; 08-24-2012 at 05:32 PM. Reason: Added code tags & formatting |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Macro to replace one specific heading style with another
|
ubns | Word VBA | 44 | 09-04-2012 08:17 PM |
| can I run a macro when I open a specific doc. | shreked | Word | 8 | 01-12-2012 03:36 AM |
Macro for highlighting specific number of words
|
icsjohn | Word VBA | 2 | 12-07-2011 06:44 PM |
Macro to remove MacroButtons
|
ilkks | Word VBA | 3 | 05-22-2011 11:03 PM |
| Remove specific recipients while replying to all | McFerra | Outlook | 0 | 12-22-2010 10:13 PM |