Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 04-20-2012, 07:36 PM
macropod's Avatar
macropod macropod is offline VBA code for changing capital letters become lower Windows 7 64bit VBA code for changing capital letters become lower Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Jasa P View Post
I've tried to use the Find & Replace that you gave me, but It doesn't work and I don't know what is wrong.
That's hardly surprising, since the data in your latest post are quite different to what you originally asked for help with. Try the following macro:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Rng As Range
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "([0-9])[Xx]"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchWildcards = True
    .Execute
  End With
  Do While .Find.Found
    Set Rng = .Duplicate
    .Duplicate.Characters.Last = "x"
    With Rng
      .Start = .Duplicate.End + 1
      Do
        If Not .Characters.Last Like "[/" & vbCr & "]" Then
          .End = .End + 1
        Else
          Exit Do
        End If
      Loop
      If InStr(1, .Text, "x", vbTextCompare) > 0 Then .Text = Replace(.Text, "x", ".", 1, , vbTextCompare)
    End With
    .Start = Rng.End
    .Find.Execute
  Loop
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]

Last edited by macropod; 04-20-2012 at 07:58 PM. Reason: Code Enhancement to handle upper/lower case 'x' replacement
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA code for changing capital letters become lower Converts the words to actual All Capital Letters not workin macro?? powerdrum Word VBA 2 12-08-2011 05:06 PM
Why the "Headings" are appearing in capital letters in the Table of contents? Jamal NUMAN Word 1 05-31-2011 08:31 AM
Search for paras beginging with a lower case MShroff Word 1 10-19-2010 06:41 AM
VBA code for changing capital letters become lower Code for Changing Cell Backgrounds leroytrolley Excel 2 12-05-2008 02:05 AM
Upper to lower case jd Excel 1 04-28-2006 07:40 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:15 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