ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Indent based on Entry (https://www.excelbanter.com/excel-discussion-misc-queries/202181-indent-based-entry.html)

JSnow

Indent based on Entry
 
I'm entering either 'no' or 'yes' in column D. If I enter 'yes' I would like
that text to automatically indent by 1 space (.IndentLevel = 1) so that it
sticks out to me. Please help me you Gods of Excel.

Gary''s Student

Indent based on Entry
 
Put the following event code in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("D:D")
Set t = Target
If Intersect(t, r) Is Nothing Then Exit Sub
If t.Value = "yes" Then
t.InsertIndent 1
End If
End Sub

--
Gary''s Student - gsnu200804


"JSnow" wrote:

I'm entering either 'no' or 'yes' in column D. If I enter 'yes' I would like
that text to automatically indent by 1 space (.IndentLevel = 1) so that it
sticks out to me. Please help me you Gods of Excel.



All times are GMT +1. The time now is 05:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com