How to fix a macro to only cut to one column?

Posted on 2011-10-11
Last Modified: 2012-05-12
I am having issues with the code below.
I only want it to cut the data from "K" NOT "L".
How do I change this?

.Range(.Cells(Cell.Row, "K"), .Cells(Cell.Row, "L")).Cut .Cells(Cell.Row, "L")
Sub MoveOver1()
    Dim Cell As Range
    Application.ScreenUpdating = False
    With ActiveSheet
'This is where the code checks for which lines have data so just use a column that has data
        For Each Cell In Intersect(.[K:K], .UsedRange)
'This checks for the blank space so change the Column letter to match the cell you are checking
            If .Cells(Cell.Row, "L").Value = "" Then
'This is the move part.  It will cut the range from the first to the second and paste in the column set after the .Cut part
                .Range(.Cells(Cell.Row, "K"), .Cells(Cell.Row, "L")).Cut .Cells(Cell.Row, "L")
            End If
        Next Cell
    End With
    Application.ScreenUpdating = True
End Sub

Open in new window

Question by:eureka15
    LVL 81

    Accepted Solution


    .Range(.Cells(Cell.Row, "K"), .Cells(Cell.Row, "L")).Cut .Cells(Cell.Row, "L")


    .Cells(Cell.Row, "K").Cut .Cells(Cell.Row, "L")


    Author Closing Comment

    I was so close...I did not remove the ".range"
    Thanks Kevin!

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Suggested Solutions

    Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
    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 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…
    This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

    755 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