View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
stainless stainless is offline
external usenet poster
 
Posts: 18
Default Paste failing after cut

On Jun 11, 9:33*pm, "Jim Cone" wrote:
Application.CutCopyMode = False clears the clipboard, so that has to be done after the paste.

Excel will also clear the clipboard with the slightest provocation.
So you always want the copy/cut to occur as close as possible to the paste.
So as a test, comment out the line "Selection.AutoFilter Field:=PurchasedWantsColumnNumber"
that occurs immediately after the cut and see what happens.

Also...
* the line "Application.CutCopyMode = xlCut can be deleted.
* gPurchasedWantsColumn is not declared.
* add "Option Explicit" as the first line in the module.

If you still have problems, provide any error messages you receive and where.
Make sure you don't have an "On Error Resume Next" in the code someplace.
--
Jim Cone
Portland, Oregon USAhttp://www.mediafire.com/PrimitiveSoftware
(free and commercial excel programs)


The gPurchasedWantsColumn is defined elsewhere and, in this instance,
contains the letter J (I will reuse this for other worksheets once it
works, so the column letters will be defined outside this process.

However, did comment out the line "Selection.AutoFilter
Field:=PurchasedWantsColumnNumber" and the cut and paste now works. So
thanks for that. Clearly, this was clearing out the cut data.

However, I have another issue.

The rows that I am cutting are not being cut in their entirety. All
rows are selected but the xlToRight command is only selecting up to
the first blank column and there are values after this column i.e.
columns A to C are selected, D and E have no values, and thus the
populated columns from F onwards are not cut.

It appears I need to somehow alter the "Range(Selection,
Selection.End(xlToRight)).Select " line to get the last populated
column

Thanks in advance for your help.