Programmatically check cell formatting

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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]...
 
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top