Results 1 to 5 of 5

Indent multiple Columns based on Value in One Column

Threaded View

  1. #1
    Registered User
    Join Date
    03-17-2011
    Location
    Guelph, Ontario, Canada
    MS-Off Ver
    Excel 2003
    Posts
    63

    Indent multiple Columns based on Value in One Column

    Hi all:
    Looking to format a BOM down-load (into Excel), so that the BOM levels are indented according to the level number.
    Levels are indicated in Column C. Columns to indent would be C thru F.
    Number of rows is undetermined.

    Setting up the code, I have the following - although so far mostly instructions without code.
    I hope the requirements are expressed clearly enough.

    Sub BomIndentCols()
    
        Dim LastRow As Integer
    
    '   Set Columns to be Indented to Default Left Align
            Range("C:F").HorizontalAlignment = xlLeft
    
    '   Determine Last Row for THIS Spread-Sheet
            LastRow = Cells(Rows.Count, "E").End(xlUp).Row
    
    '   Go to C, Last Row
            Range("C" & LastRow).Select
    
        '   If C = Blank, Do Nothing
        '   If C = 0, Do Nothing
        '   If C = 1, Indent 2 spaces
        '   If C = 2, Indent 4 Spaces
        '   If C = 3, Indent 6 Spaces
        '   If C = 4, Indent 8 Spaces
        '   If C = 5, Indent 10 Spaces
        '   If C = 6, Indent 12 Spaces
    
        '   Indent Columns C, D, E & F,  In current Row,  according to above.
        
        '   Move UP one Row, and repeat,  Until all completed, or until error
        '   (Several rows at top will be headings - therefore NOT be blank, or 0 thru 6)
    
    End Sub
    Last edited by BEEJAY; 04-15-2011 at 03:36 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1