Results 1 to 3 of 3

Using vb to Correctly format sentances

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-16-2009
    Location
    australia
    MS-Off Ver
    Excel 2007
    Posts
    116

    Using vb to Correctly format sentances

    I am looking at the formula/macro and want a little help with how I could adjust it to add in a Range that I have as a defined name. In my case I defined the range as "comments".

    I am drawing the basis of the formula from this thread http://www.excelforum.com/excel-gene...ence-case.html
    Which uses this as the solution to Correctly formatting sentences in cells. I want to use it with defined ranges.

    Sub AAA()
    Dim Rng As Range
    For Each Rng In ActiveSheet.UsedRange.SpecialCells( _
    xlCellTypeConstants, xlTextValues)
    Rng.Value = UCase(Left(Rng.Text, 1)) & Mid(Rng.Text, 2)
    Next Rng
    End Sub
    Tried changing it to because my activesheet is called ServiceDeliveryTemplate and the defined name is Comments but I am not selecting the range correctly.

    Sub AAA()
    Dim Rng As Range
    For Each Rng In ServiceDeliveryTemplate.Comments.SpecialCells(xlCellTypeConstants, xlTextValues)
    Rng.Value = UCase(Left(Rng.Text, 1)) & Mid(Rng.Text, 2)
    Next Rng
    End Sub
    Last edited by pike; 07-02-2010 at 05:06 AM. Reason: correct code tag error

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1