Solved

Excel macro to shift columns

Posted on 2013-05-29
1
375 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

777 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