• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Moving Cells. Where am I going wrong?

Hi,

I am trying to take cells in Columns "I" to "M" in a variable row (lngI) and move them to Columns "N" to "R" in the row above (lngI-1).

Somewhere I'm going wrong, can anyone see my error??

Thanks

Code:
If Left(Cells(lngI, 8), 5) = "BASIC" Then Cells("I" & lngI & ":" & "M" & lngI).Copy Cells.Offset(-1, 13)
 
This is the culprit:
Cells.Offset(-1, 13)

Cells refers to all the cells in the sheet. Makes no sense to offset -1 (you be be in row 0!) :p

Change code line to this:
Code:
If Left(Cells(lngI, 8), 5) = "BASIC" Then Cells("I" & lngI & ":" & "M" & lngI).Copy Cells(lngI - 1, "N")
 
Hi actually I got it figured out:
Code:
If Left(Cells(lngI, 8), 5) = "BASIC" Then Range("I" & lngI & ":" & "M" & lngI).Copy Cells(lngI, 14).Offset(-1)
 
Back
Top