Consulting

Results 1 to 4 of 4

Thread: Solved: how to convert first later to upper case and after onward lower case?

  1. #1

    Solved: how to convert first later to upper case and after onward lower case?

    i try this code in my sh
    but it go in loop and do nothing
    can some one help me

    [vba]Option Explicit

    Sub ChangeCase_5()
    Dim r As Range, RNG As Range, s As Double, c As Double, d As Double
    Dim LR As Long
    Application.ScreenUpdating = False

    With Worksheets("Report")

    LR = .Range("C" & .Rows.Count).End(xlUp).Row
    Set r = .Range("C5:C" & LR)

    Do
    Set RNG = Nothing

    On Error Resume Next

    Set RNG = .Range("c6:C" & LR).SpecialCells(xlCellTypeVisible) 'if no items found
    RNG.Value = StrConv(RNG, vbProperCase)
    RNG.Offset(, 10).Value = "RNG"
    Loop
    End With

    ExitHandler:
    Set r = Nothing
    Application.ScreenUpdating = True
    End Sub
    [/vba]
    Last edited by Aussiebear; 11-20-2010 at 05:34 PM. Reason: Adjusted to use the correct tags around the code section

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,064
    Location
    Have a look at Proper case

    I would assume it should be something like this

    [VBA]For each RNG.Value in r
    RNG.Value = StrConv(RNG, vbProperCase)
    Next RNG.Value[/VBA]

    or something similar. I could well be wrong but my assumption is just using the line RNG.Value= StrConv(RNG, vbProperCase) is like saying "kick the ball" rather than saying something like
    For each ball that comes near you during the game,
    kick the ball
    Next ball
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    to get you started:[VBA]Sub ChangeCase_5()
    Dim cll As Range, RNG As Range, s As Double, c As Double, d As Double
    Dim LR As Long
    Application.ScreenUpdating = False

    With Worksheets("Report")
    LR = .Range("C" & .Rows.Count).End(xlUp).Row
    Set RNG = Nothing
    On Error Resume Next
    Set RNG = .Range("c6:C" & LR).SpecialCells(xlCellTypeVisible) 'if no items found
    For Each cll In RNG.Cells
    cll.Value = StrConv(cll.Value, vbProperCase)
    cll.Offset(, 10).Value = cll.Value
    Next cll
    End With

    ExitHandler:
    Application.ScreenUpdating = True
    End Sub
    [/VBA]
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  4. #4
    hi
    Aussiebear and
    p45cal
    it's work fine
    thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •