Macro to conditionally format relative to position

Ashe77

New Member
Joined
May 23, 2013
Messages
13
Hi all

An odd request but I am using a program (against my preference) to create project plans which I then download to an excel file as an output and paste into another worksheet into a table. As it's downloading from a project style of indented child entries below parents, I'd like to conditionally format the table so that the child entries can be made into bold text. The issue is that it doesn't download with indents but actual spaces before the text. So ideally I need a macro that will instruct to bold entries with x amount of spaces in front (10, 15 and 20 spaces).

Can this be done?

Thanks in advance, Paul
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I've seen waaaay stranger requests in this place..!

A simple example...
Code:
Sub Macro1()
Dim cl As Range
For Each cl In Columns(1).SpecialCells(xlCellTypeConstants)
    If Left(cl, 5) = "     " Then cl.EntireRow.Font.Bold = True
Next cl
End Sub

this looks at every cell in column 1 containing a constant (i.e. not a formula), and applies bold to the entire row if the first 5 text characters are spaces
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,027
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top