Mini-Travis
New Member
- Joined
- Nov 30, 2010
- Messages
- 5
Good afternoon,
I am having trouble coming up with the code I need to complete a particular task.
Background: I created vba code that would go through a range of cells and remove strikethrough text and turn red text black. This works perfectly for that particular task.
Code:
For Each c In MyRange
OldText = c.Text
For iCh = 1 To Len(c)
With c.Characters(iCh, 1)
If .Font.Strikethrough = True Then
BadText = BadText & .Text
End If
End With
Next iCh
NewText = Replace(OldText, BadText, blankText)
c.Value = NewText
c.Characters.Font.Strikethrough = False
c.Characters.Font.Color = RGB(0, 0, 0)
Problem: I am trying to figure out how to do the exact opposite of what this code currently does. For Example, if a cell has text that is stuckthrough I would like to remove the strikethrough property and turn the text black. Then i would like to go through the range a second time looking for text that is red. When this text is found, I would like to delete that particular string.
I hope I was able to explain the problem in the level of detail needed to aquire a solution.
I am having trouble coming up with the code I need to complete a particular task.
Background: I created vba code that would go through a range of cells and remove strikethrough text and turn red text black. This works perfectly for that particular task.
Code:
For Each c In MyRange
OldText = c.Text
For iCh = 1 To Len(c)
With c.Characters(iCh, 1)
If .Font.Strikethrough = True Then
BadText = BadText & .Text
End If
End With
Next iCh
NewText = Replace(OldText, BadText, blankText)
c.Value = NewText
c.Characters.Font.Strikethrough = False
c.Characters.Font.Color = RGB(0, 0, 0)
Problem: I am trying to figure out how to do the exact opposite of what this code currently does. For Example, if a cell has text that is stuckthrough I would like to remove the strikethrough property and turn the text black. Then i would like to go through the range a second time looking for text that is red. When this text is found, I would like to delete that particular string.
I hope I was able to explain the problem in the level of detail needed to aquire a solution.