Solved

Excel macro to shift columns

Posted on 2013-05-29
1
350 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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

763 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

7 Experts available now in Live!

Get 1:1 Help Now