Solved

# formatting excel data

Posted on 2011-02-25

Hello,

I have an excel spreadsheet with one column of data that I would like to format with leading spaces based on the number of leading blank spaces there are currently and the data style. All of my data is in column A and I would like to format it and move it to a new worksheet, keeping it all in the same column.

So I would need some VBA code to do this:

If cell value font is in italics and has either 20 leading spaces or 35 leading spaces, indent it with 7 leading spaces.

Else if cell value font is bold and has either 15 leading spaces or 25 leading spaces, indent it with 5 leading spaces.

Else if cell value font is bold and has either 10 leading spaces or 20 leading spaces, indent it with 3 leading spaces.

I know this sounds very random, but this is how the data comes out of a Hyperion report.

If you're unsure of the answer, please let someone else take it. It seems that there's an etiquette here that if another expert is already on it, other experts won't jump in. Which is fine, but I would rather someone who really knows excel to answer the question.

Thank you.