#1   Report Post  
Posted to microsoft.public.excel.programming
vtj vtj is offline
external usenet poster
 
Posts: 9
Default Paste

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Paste

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

--
Rick (MVP - Excel)


"vtj" wrote in message
...
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?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,276
Default Paste

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

"vtj" wrote:

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?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paste and Paste Special No Longer Working - Excel 2003 SheriJ Excel Discussion (Misc queries) 2 January 15th 09 09:23 PM
Automating copy/paste/paste special when row references change Carl LaFong Excel Programming 4 October 8th 07 06:10 AM
In Excel: add a Paste-Special Option to paste IN REVERSE ORDER. stan-the-man Excel Worksheet Functions 7 June 14th 06 08:10 PM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM
Macro to Paste to specific line, and continue to Paste each time on next row not over tomkarakowski[_2_] Excel Programming 1 May 28th 04 06:50 PM


All times are GMT +1. The time now is 09:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"