The user trying to do some automatic formatting of a list of data to create an indented BOM structure.
The user wants to set the Indent Level for Column B by values in Column A. i.e. a value of 1 in Cell A1 indents Cell B1 by 1.
Right click the sheet tab and paste this code in the sheet code module.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("A:A"), Target) Is Nothing Then
If IsNumeric(Target.Value) Then
If Target.Value >= 0 Then
Target.Offset(0, 1).IndentLevel = Target.Value
Obtained from the OzGrid Help Forum.
Solution provided by Andy Pope.
|How to use a Macro to copy rows from multiple worksheets based on a cell value greater than zero
|How to remove the last X number of characters depending on the ending of the value
|How to sum cell numerical values based on text suffix
|How to sort values in positive and negative numbers with formula