Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 04-20-2012, 06:02 AM
Jasa P Jasa P is offline VBA code for changing capital letters become lower Windows XP VBA code for changing capital letters become lower Office 2007
Novice
VBA code for changing capital letters become lower
 
Join Date: Apr 2012
Posts: 13
Jasa P is on a distinguished road
Default

hi, thank u very much for your reply 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.

Yes, they are terminated by "/", but not for the ending of each data. As you can see, after the end of SO1, there's no "/"

Note: ^t ---> tab character

S01=02^t45.01.39.05x245x201x939x905x01x45x39x05x37 x73/01.30.66.00.28.64x74x45x5x10

L01=03^t0266X2/2066X2/6066X2/6766X2/266X3/066X3/766X3/66X10/15X5/51X5/11X5/16X5/516X5/99X5


L02=04^t06X5.60.5.2.5/20X5.5.5.50.5.3.3


B01=05 62.58.75.85.26.08.80.45.42X2X54X72X15X299X8X15X63X 57X5/50X7X56X45X30X90X4/06.76.16.86.24X4/439.39X6/49.94.15.51X100


B02=07^t29.92.26.62.36.63.46.64.59X3x95x6/278.295.241.277x244X248X2/78.95.85.41.77.44X4x53X2/578.578.539x2/78.76.39x4/13.25.52.28.82.18.81X6


They should be like this:
S01=02^t45.01.39.05x245.201.939.905.01.45.39.05.37 .73/01.30.66.00.28.64x74.45.5.10

L01=03^t0266x2/2066x2/6066x2/6766x2/266x3/066x3/766x3/66x10/15x5/51x5/11x5/16x5/516x5/99x5


L02=04^t06x5.60.5.2.5/20x5.5.5.50.5.3.3


B01=05 62.58.75.85.26.08.80.45.42x2.54.72.15.299.8.15.63. 57.5/50.7.56.45.30.90.4/06.76.16.86.24x4/439.39x6/49.94.15.51x100


B02=07^t29.92.26.62.36.63.46.64.59x3.95.6/278.295.241.277x244.248.2/78.95.85.41.77.44x4.53.2/578.578.539x2/78.76.39x4/13.25.52.28.82.18.81x6



I've the macro in Excel for the same functions, but of course it doesn't work in Word. The code:
Code:
Sub test()
    Dim rng As Range, r As Range, x, i As Long
    On Error Resume Next
    Set rng = Cells.SpecialCells(2)
    On Error GoTo 0
    If rng Is Nothing Then Exit Sub
    With CreateObject("vbscript.regexp")
        .IgnoreCase = True
        .Pattern = "(.*)(x)(.*)(\2)(.*)"
        For Each r In rng
            x = Split(LCase$(r.Value), "/")
            For i = 0 To UBound(x)
                Do While  .test(x(i))
                    x(i) = .Replace(x(i), "$1x$3.$5")
                Loop
            Next
            r.Value = Join$(x, "/")
        Next
    End With
    Set rng = Nothing
End Sub
I attached some sample files here:
https://www.msofficeforums.com/attac...1&d=1334926607
https://www.msofficeforums.com/attac...1&d=1334926817
Thanks a lot Macropod


Regards,


Jasa
Attached Files
File Type: docx Sample.docx (12.0 KB, 12 views)
File Type: xlsm Sample.xlsm (15.9 KB, 8 views)
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 12:46 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