Can I use conditional formatting to INDENT a cell?

InactiveB0845

New Member
Joined
Nov 28, 2010
Messages
8
I'm building a basic spreadsheet to teach accounting ledger entries. On credits, the account name and amount need to be indented. Can I use conditional formatting to include the indent based on the entry in the first column? If not, is there another solution?

For example, the columns would go as follows:
Debit/Credit , Account Name , Amount .

In the first column, they would enter either D or C. If they enter C for credit, then the corresponding entries in the other two columns would get an indentation.

Thanks for any help!!

Tom
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Take a look at this macro it will do as you want it to:

Sample before:
Excel Workbook
CDE
1Debit/creditAccount NameAmount
2CBill Jones34
3DJohn Hall45
4CGraham Kens56
5DAlice Digger67
Sheet1

Sample after running macro

Excel Workbook
CDE
1Debit/creditAccount NameAmount
2CBill Jones34
3DJohn Hall45
4CGraham Kens56
5DAlice Digger67
Sheet1

Code I created uses an IF Statement with a loop, sample shown below, I hope it helps

Sub Macro1()
Range("C1").Select
Do Until ActiveCell.Value = ""
If ActiveCell = "C" Then
ActiveCell.Offset(0, 1).InsertIndent 1
ActiveCell.Offset(0, 2).InsertIndent 1
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,634
Members
452,934
Latest member
Jdsonne31

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