Paste

  • Thread starter Thread starter vtj
  • Start date Start date
V

vtj

I'm using Excel 2007. I'm trying to cut a value if it is negative and move
it to a different column. The following cuts the value but I can't get it to
paste:

Range("N2").Select
If Selection.Value < 0 Then Selection.Cut
ActiveCell.Offset(0, -1).Select
This is some of what I have tried but none work-
'Range.PasteSpecial.xlPasteValues
'ActiveCell.Pastetype.Pasteall
'ActiveCell.PasteSpecial Paste:=xlPastevalues, operation:=xlNone, _
'skipBlanks:=False, Transpose:=False

It moves to the proper cell but I can not get paste, xlpaste to work in any
variation that I have tried. What is the correct paste command?
 
I'm guessing that you simplified your question for us and that you will
ultimately want to apply this functionality to a column of values (moving
the negative ones one column to the left). Give this macro a try (just set
the Col variable to the letter(s) for the column you want to apply this
function to)...

Sub MoveNegativeValuesOneColumnLeft()
Dim C As Range
Dim Col As String
Col = "N"
For Each C In Range(Cells(2, Col), Cells(Rows.Count, Col).End(xlUp))
If C.Value < 0 Then
C.Offset(, -1).Value = C.Value
C.Value = ""
End If
Next
End Sub
 
Hi
try
Range("N2").Select
If Selection.Value < 0 Then Selection.Cut
ActiveSheet.Paste Destination:=Range("A1")

change the destination range to fit your needs

if this helps please click yes, thanks
 
Back
Top