Solved

Excel macro to shift columns

Posted on 2013-05-29
1
364 Views
Last Modified: 2013-08-22
Starting from row 1 in column D, I need to look at the values in column D.  If the value in the cell is not equal to "*",  then shift cells D and E to the right one column.
0
Comment
Question by:dbfromnewjersey
1 Comment
 
LVL 33

Accepted Solution

by:
Norie earned 500 total points
ID: 39204903
Try this.
Sub ShiftThings()
Dim I As Long

    For I = 1 To Range("D" & Rows.Count).End(xlUp).Row
        If Range("D" & I).Value <> "*" Then
           Range("D" & I).Insert xlShiftToRight
        End If
    Next I

End Sub

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
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…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

912 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now