Push cells down in Excel.

Posted on 2012-08-21
Last Modified: 2012-09-03
I am looking for a way in excel to push all the cells from D to K by one. Any ideas?
Question by:Blowfelt82
    LVL 33

    Expert Comment

    Select the range and click on the edge of the selected area and drag and drop to the position you want...

    Author Comment

    Sorry, my fault... I meant to do this in VBA script
    LVL 33

    Expert Comment

    Something like this:

    Selection.Cut Destination:=Range("D2")

    Author Comment

    Ok, I am using the line Cells(i, 1).Select, so will not necessarily know the column letter, is there a way I can do this from the selected cell row?
    LVL 33

    Accepted Solution

    If you want to move a range, you can just select a cell with Cells(x,y), you need to select a range.
    LVL 8

    Expert Comment

    by:Elton Pascua
    Not sure by what you mean to "push down" when you want to move values across.

    The procedure below moves all your cells in column D to column K. All columns from D and K will all move to the right. Not sure if this is what you wanted.

    Sub MoveToK()
        Dim ws As Worksheet
        Set ws = ThisWorkbook.Worksheets("Sheet1")
        Dim lr As Long
        Dim moveRange As Range
        Dim i As Integer
        lr = ws.UsedRange.Rows.Count
        Set moveRange = ws.Range("D1:D" & lr)
        For i = 1 To 7
            moveRange.Insert Shift:=xlToRight
        Next i
    End Sub

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    What is a Form List Box? (skip if you know this) The forms List Box is the alternative to the ActiveX list box. If you are using excel 2007, you first make sure you have a developer tab (click the Orb)->"Excel Options"->Popular->"Show Developer tab…
    How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
    The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
    The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

    758 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

    10 Experts available now in Live!

    Get 1:1 Help Now