Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Copy and Paste Special #Value Error

I have some code that I use to make a new worksheet and I need to copy and
paste the values from one column to another in the new worksheet. The cells
that I copy from have formulas and are dependent on other cells that may or
may not have values in them. The problem that I am having is that the cells
that have no values on the old worksheet return a #value when pasted on the
new sheet. My preference would be to have a blank cell. The code that I am
using at present is below and I am running Office 2003.

Sub NewInventory()


ActiveSheet.Copy After:=ActiveSheet
Range("A1") = Range("A1") + 1
Range("G5:G507").Select
Selection.Copy
Range("E5").Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=True, _
Transpose:=False
Range("H5:H507,J5:J507,S5:S507").Select
Selection.ClearContents
Range("A1").Select
End Sub
--
Thanks and Regards,
Don
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 515
Default Copy and Paste Special #Value Error

It is not the paste special action that causes the problem, but rather the
formulae in the original cells. If the formula result in the original cells
evaluates to an error, your paste special operation has no option but to copy
that formula result to the destination cell.

Rather post the formula in the original cell, ad we can suggest a
workaround. Normally, a simple IF statement will take care of your problem.
Something like
=IF(ISERROR(your formula),"",your formula).
Iow, =IF(ISERROR(B6*C6),"",B6*C6), will give a result where possible, but
when one of the cells contain nothing, or text, the result will be nothing,
iso #NUM, #N/A or #WHATEVER
--
HTH

Kassie

Replace xxx with hotmail


"SSDSCA" wrote:

I have some code that I use to make a new worksheet and I need to copy and
paste the values from one column to another in the new worksheet. The cells
that I copy from have formulas and are dependent on other cells that may or
may not have values in them. The problem that I am having is that the cells
that have no values on the old worksheet return a #value when pasted on the
new sheet. My preference would be to have a blank cell. The code that I am
using at present is below and I am running Office 2003.

Sub NewInventory()


ActiveSheet.Copy After:=ActiveSheet
Range("A1") = Range("A1") + 1
Range("G5:G507").Select
Selection.Copy
Range("E5").Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=True, _
Transpose:=False
Range("H5:H507,J5:J507,S5:S507").Select
Selection.ClearContents
Range("A1").Select
End Sub
--
Thanks and Regards,
Don

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Copy and Paste Special #Value Error

Kassie
Being reasonably versed with formulas and a struggling novice with writing
macros, I had assumed that my problem was the macro. Thanks a million for the
response - works like a charm.
--
Thanks and Regards,
Don


"Kassie" wrote:

It is not the paste special action that causes the problem, but rather the
formulae in the original cells. If the formula result in the original cells
evaluates to an error, your paste special operation has no option but to copy
that formula result to the destination cell.

Rather post the formula in the original cell, ad we can suggest a
workaround. Normally, a simple IF statement will take care of your problem.
Something like
=IF(ISERROR(your formula),"",your formula).
Iow, =IF(ISERROR(B6*C6),"",B6*C6), will give a result where possible, but
when one of the cells contain nothing, or text, the result will be nothing,
iso #NUM, #N/A or #WHATEVER
--
HTH

Kassie

Replace xxx with hotmail


"SSDSCA" wrote:

I have some code that I use to make a new worksheet and I need to copy and
paste the values from one column to another in the new worksheet. The cells
that I copy from have formulas and are dependent on other cells that may or
may not have values in them. The problem that I am having is that the cells
that have no values on the old worksheet return a #value when pasted on the
new sheet. My preference would be to have a blank cell. The code that I am
using at present is below and I am running Office 2003.

Sub NewInventory()


ActiveSheet.Copy After:=ActiveSheet
Range("A1") = Range("A1") + 1
Range("G5:G507").Select
Selection.Copy
Range("E5").Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=True, _
Transpose:=False
Range("H5:H507,J5:J507,S5:S507").Select
Selection.ClearContents
Range("A1").Select
End Sub
--
Thanks and Regards,
Don

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 515
Default Copy and Paste Special #Value Error

The pleasure is all mine Don

--
HTH

Kassie

Replace xxx with hotmail


"SSDSCA" wrote:

Kassie
Being reasonably versed with formulas and a struggling novice with writing
macros, I had assumed that my problem was the macro. Thanks a million for the
response - works like a charm.
--
Thanks and Regards,
Don


"Kassie" wrote:

It is not the paste special action that causes the problem, but rather the
formulae in the original cells. If the formula result in the original cells
evaluates to an error, your paste special operation has no option but to copy
that formula result to the destination cell.

Rather post the formula in the original cell, ad we can suggest a
workaround. Normally, a simple IF statement will take care of your problem.
Something like
=IF(ISERROR(your formula),"",your formula).
Iow, =IF(ISERROR(B6*C6),"",B6*C6), will give a result where possible, but
when one of the cells contain nothing, or text, the result will be nothing,
iso #NUM, #N/A or #WHATEVER
--
HTH

Kassie

Replace xxx with hotmail


"SSDSCA" wrote:

I have some code that I use to make a new worksheet and I need to copy and
paste the values from one column to another in the new worksheet. The cells
that I copy from have formulas and are dependent on other cells that may or
may not have values in them. The problem that I am having is that the cells
that have no values on the old worksheet return a #value when pasted on the
new sheet. My preference would be to have a blank cell. The code that I am
using at present is below and I am running Office 2003.

Sub NewInventory()


ActiveSheet.Copy After:=ActiveSheet
Range("A1") = Range("A1") + 1
Range("G5:G507").Select
Selection.Copy
Range("E5").Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=True, _
Transpose:=False
Range("H5:H507,J5:J507,S5:S507").Select
Selection.ClearContents
Range("A1").Select
End Sub
--
Thanks and Regards,
Don

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
Special Copy, Paste Special macro usmc-r70 Excel Programming 3 July 2nd 09 08:12 AM
Automating copy/paste/paste special when row references change Carl LaFong Excel Programming 4 October 8th 07 06:10 AM
help w/ generic copy & paste/paste special routine DavidH[_2_] Excel Programming 5 January 23rd 06 03:58 AM
Cut and Paste using Macro gives paste special method error Lourens Pentz Excel Programming 3 November 21st 04 10:42 PM
Dynamic Copy/Paste Special Formulas/Paste Special Values Sharon Perez Excel Programming 3 August 7th 04 09:49 PM


All times are GMT +1. The time now is 06:22 PM.

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"