Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Copy column two rows over

Posted on 2014-02-14
2
Medium Priority
?
136 Views
Last Modified: 2014-02-20
I need to copy over left 2 columns not one.   I need help changing this code.

 Sheets("Sheet1").Select
 Range("C1").Select
Selection.SpecialCells(xlBlanks).Delete shift:=xlToLeft
0
Comment
Question by:leezac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Assisted Solution

by:Harry Lee
Harry Lee earned 1000 total points
ID: 39860644
leezac,

do you mean these codes?

Dim I As Long
    For I = 2 To Range("J" & Rows.Count).End(xlUp).Row
        If Range("J" & I).Value <> "R" Then
            Range("I"& I).Value = Range("J" & I).Value
            Range("J" & I).Value = ""
        End If
    Next I

Open in new window


Just change it to

Dim I As Long
    For I = 2 To Range("J" & Rows.Count).End(xlUp).Row
        If Range("J" & I).Value <> "R" Then
            Range("H"& I).Value = Range("J" & I).Value
            Range("J" & I).Value = ""
        End If
    Next I

Open in new window

0
 
LVL 31

Accepted Solution

by:
gowflow earned 1000 total points
ID: 39863042
try this

Sheets("Sheet1").Select
 Range("H1").Select
Range(Selection.Offset(0, -2), Selection.Offset(0, -1)).Delete shift:=xlToLeft

Open in new window


gowflow
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

618 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