+ Reply to Thread
Results 1 to 2 of 2

Repeat Title Formatting With Macro

  1. #1
    Registered User
    Join Date
    09-05-2005
    Posts
    18

    Repeat Title Formatting With Macro

    Hi

    Not the most gifted user of macros - can record something basic, but am hoping to develop a bit more talent.
    Anyway, need advice with the following:

    I have a number of reports that i import to excel - within these reports are recurring titles over different accounts.

    I want a macro that will format each occurance of a title in a pretty way (i.e. bold, 12 font, wrap text, row height 34).
    Unfortunatly the title headings do not occur at regular intervals each time the report is run as it depends on the number of order for each account.

    Any help would be greatly appreciated.

    Thanks

    Tim

  2. #2
    Fred
    Guest

    Re: Repeat Title Formatting With Macro

    Tim, try the following.

    Sub FormatTitles()
    Dim firstCell As Range
    Dim nextCell As Range
    Dim TitleStr As String
    TitleStr = "Title Text"
    Set firstCell = Cells.Find(What:=TitleStr, After:=ActiveCell, _
    LookIn:=xlFormulas, LookAt:=xlWhole)
    If Not firstCell Is Nothing Then
    FormatCell TitleCell:=firstCell
    Set nextCell = Cells.FindNext(After:=firstCell)
    While nextCell.Address <> firstCell.Address
    FormatCell TitleCell:=nextCell
    Set nextCell = Cells.FindNext(After:=nextCell)
    Wend
    End If
    End Sub

    Sub FormatCell(TitleCell As Range)
    TitleCell.Font.Bold = True

    '...

    End Sub


    "iambalrog" <[email protected]> wrote
    in message news:[email protected]...
    >
    > Hi
    >
    > Not the most gifted user of macros - can record something basic, but am
    > hoping to develop a bit more talent.
    > Anyway, need advice with the following:
    >
    > I have a number of reports that i import to excel - within these
    > reports are recurring titles over different accounts.
    >
    > I want a macro that will format each occurance of a title in a pretty
    > way (i.e. bold, 12 font, wrap text, row height 34).
    > Unfortunatly the title headings do not occur at regular intervals each
    > time the report is run as it depends on the number of order for each
    > account.
    >
    > Any help would be greatly appreciated.
    >
    > Thanks
    >
    > Tim
    >
    >
    > --
    > iambalrog
    > ------------------------------------------------------------------------
    > iambalrog's Profile:
    > http://www.excelforum.com/member.php...o&userid=26977
    > View this thread: http://www.excelforum.com/showthread...hreadid=401889
    >




+ Reply to Thread

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