Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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"
wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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"
wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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"
wrote in message
...
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"

wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional formatting - check for blank cell Eric_NY Excel Discussion (Misc queries) 3 August 18th 09 05:08 PM
suppress conditional formatting programmatically Janis Excel Discussion (Misc queries) 1 September 25th 07 12:06 AM
Check if Conditional Format is True or False / Check cell Color Kevin McCartney Excel Worksheet Functions 5 June 29th 07 11:12 AM
How to programmatically check if a workbook is protected t? uno@korsmaa Excel Programming 2 September 15th 04 09:23 PM
How to check programmatically whether Excel is installed on computer? Jack Excel Programming 7 February 15th 04 02:30 AM


All times are GMT +1. The time now is 01:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"