+ Reply to Thread
Results 1 to 4 of 4

Programmatically check cell formatting

  1. #1
    WhyIsEverythingSoConfusing
    Guest

    Programmatically check cell formatting

    I have exported a task list from Project. Column C contains task names.
    Summary tasks are bold and actual (working) tasks are not. I would like to
    (until there isn't any more data in Column C) insert a row after each task
    that is not a summary task (ie, not bold).

    I found other examples of inserting rows, but I don't know how to check this
    specific cell/text formatting.

    Any help is greatly appreciated.
    --------------
    Justin

  2. #2
    Chip Pearson
    Guest

    Re: Programmatically check cell formatting

    Try something like the following:



    Dim RowNdx As Long
    Dim LastRow As Long
    LastRow = Cells(Rows.Count, "C").End(xlUp).Row
    For RowNdx = LastRow To 1 Step -1
    If Cells(RowNdx, "C").Font.Bold = False Then
    Rows(RowNdx + 1).Insert
    End If
    Next RowNdx



    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com


    "WhyIsEverythingSoConfusing" <[email protected]>
    wrote in message
    news:[email protected]...
    >I have exported a task list from Project. Column C contains
    >task names.
    > Summary tasks are bold and actual (working) tasks are not. I
    > would like to
    > (until there isn't any more data in Column C) insert a row
    > after each task
    > that is not a summary task (ie, not bold).
    >
    > I found other examples of inserting rows, but I don't know how
    > to check this
    > specific cell/text formatting.
    >
    > Any help is greatly appreciated.
    > --------------
    > Justin




  3. #3
    WhyIsEverythingSoConfusing
    Guest

    Re: Programmatically check cell formatting

    Works like a champ, thanks!

    One little issue, though. All of my cells have borders. Rows inserted in
    the middle of the document maintain these borders. The last inserted row
    doesn't, however.

    Is there a quick way to ensure that this last row has the same formatting as
    the rest of the rows?
    --------------
    Justin


    "Chip Pearson" wrote:

    > Try something like the following:
    >
    >
    >
    > Dim RowNdx As Long
    > Dim LastRow As Long
    > LastRow = Cells(Rows.Count, "C").End(xlUp).Row
    > For RowNdx = LastRow To 1 Step -1
    > If Cells(RowNdx, "C").Font.Bold = False Then
    > Rows(RowNdx + 1).Insert
    > End If
    > Next RowNdx
    >
    >
    >
    > --
    > Cordially,
    > Chip Pearson
    > Microsoft MVP - Excel
    > Pearson Software Consulting, LLC
    > www.cpearson.com
    >
    >
    > "WhyIsEverythingSoConfusing" <[email protected]>
    > wrote in message
    > news:[email protected]...
    > >I have exported a task list from Project. Column C contains
    > >task names.
    > > Summary tasks are bold and actual (working) tasks are not. I
    > > would like to
    > > (until there isn't any more data in Column C) insert a row
    > > after each task
    > > that is not a summary task (ie, not bold).
    > >
    > > I found other examples of inserting rows, but I don't know how
    > > to check this
    > > specific cell/text formatting.
    > >
    > > Any help is greatly appreciated.
    > > --------------
    > > Justin

    >
    >
    >


  4. #4
    Chip Pearson
    Guest

    Re: Programmatically check cell formatting

    The borders are retained for all cells when I run the code.


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com


    "WhyIsEverythingSoConfusing" <[email protected]>
    wrote in message
    news:[email protected]...
    > Works like a champ, thanks!
    >
    > One little issue, though. All of my cells have borders. Rows
    > inserted in
    > the middle of the document maintain these borders. The last
    > inserted row
    > doesn't, however.
    >
    > Is there a quick way to ensure that this last row has the same
    > formatting as
    > the rest of the rows?
    > --------------
    > Justin
    >
    >
    > "Chip Pearson" wrote:
    >
    >> Try something like the following:
    >>
    >>
    >>
    >> Dim RowNdx As Long
    >> Dim LastRow As Long
    >> LastRow = Cells(Rows.Count, "C").End(xlUp).Row
    >> For RowNdx = LastRow To 1 Step -1
    >> If Cells(RowNdx, "C").Font.Bold = False Then
    >> Rows(RowNdx + 1).Insert
    >> End If
    >> Next RowNdx
    >>
    >>
    >>
    >> --
    >> Cordially,
    >> Chip Pearson
    >> Microsoft MVP - Excel
    >> Pearson Software Consulting, LLC
    >> www.cpearson.com
    >>
    >>
    >> "WhyIsEverythingSoConfusing"
    >> <[email protected]>
    >> wrote in message
    >> news:[email protected]...
    >> >I have exported a task list from Project. Column C contains
    >> >task names.
    >> > Summary tasks are bold and actual (working) tasks are not.
    >> > I
    >> > would like to
    >> > (until there isn't any more data in Column C) insert a row
    >> > after each task
    >> > that is not a summary task (ie, not bold).
    >> >
    >> > I found other examples of inserting rows, but I don't know
    >> > how
    >> > to check this
    >> > specific cell/text formatting.
    >> >
    >> > Any help is greatly appreciated.
    >> > --------------
    >> > Justin

    >>
    >>
    >>




+ 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