Results 1 to 10 of 10

Thread: Strange character on table range text

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,273
    Location
    Personally, I'd keep it simple:
    Sub Test()
        Dim OnRg2 As Range
        Set OnRg2 = ActiveDocument.Tables(1).Rows(1).Cells(1).Range
        With OnRg2
            .End = .End - 1
            Select Case Trim(.Text)
                Case "Low"
                    .Text = "Low to Moderate"
                Case "Low to Moderate"
                    .Text = "Moderate"
                Case "Moderate"
                    .Text = "Moderate to High"
                Case "Moderate to High"
                    .Text = "High"
                Case "High"
                    .Text = "Low"
            End Select
        End With
    End Sub
    Don: Note the alternate way of getting the cell's contents without the end-of-cell marker (.End = .End - 1). Also, the Trim function's there 'cause I can't see why you'd be concerned with whether a space before/after the test strings. Maybe there is a good reason - but it's not apparent.
    Last edited by Aussiebear; 12-28-2024 at 07:54 PM.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

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