Solved

Indent column in excel VBA & Align to bottom

Posted on 2014-02-25
1
853 Views
Last Modified: 2014-02-25
I need to create vba code to indent 1 step in column P from row 2 down to the last row that has a value in column A. Can anyone shed some light on how I can do this?

I also need to have all my rows from row 2 down to the last row that has a value in column A to align to the bottom of the cells.
0
Comment
Question by:Lawrence Salvucci
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 12

Accepted Solution

by:
Harry Lee earned 500 total points
ID: 39886656
lsalvucci,

This should do the trick for you.

Sub IndentandBottomAlignColumnP()
Dim RW As Long, I As Long
RW = Cells(Rows.Count, 16).End(xlUp).Row

For I = 2 To RW
    If Cells(I, 1) <> "" Then
        Cells(I, 1).EntireRow.Select
        With Selection
            .VerticalAlignment = xlBottom
        End With
    End If
Next

With Range(Cells(2, 16), Cells(RW, 16))
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlBottom
    .AddIndent = False
    .IndentLevel = 1
    .ShrinkToFit = False
End With
End Sub

Open in new window

0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

742 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question