Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clear values

Hi
I would like to copy a range and paste it elswhere but only formulas ad
formats, without pasting the values that were int he copied range. How would
I do this?
Thanks!
Rene'
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Clear values

rng1.Copy
rng2.Pastespecial Paste:= xlPasteFormulas
rng2.Pastespecial Paste:= xlPasteFormats

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Rene'" wrote in message
...
Hi
I would like to copy a range and paste it elswhere but only formulas ad
formats, without pasting the values that were int he copied range. How

would
I do this?
Thanks!
Rene'



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Clear values

Thanks for the reply

My code:
Range("D1:D376").Select
Selection.Copy
Range("C1:C376").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValidation, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

This is copying cell contents over to the new range. Also I forgot to ask
the original question of clearing values. If I select a range, can I clear
only the values and not the formulas?
THanks for your help!
Renee
"Bob Phillips" wrote:

rng1.Copy
rng2.Pastespecial Paste:= xlPasteFormulas
rng2.Pastespecial Paste:= xlPasteFormats

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Rene'" wrote in message
...
Hi
I would like to copy a range and paste it elswhere but only formulas ad
formats, without pasting the values that were int he copied range. How

would
I do this?
Thanks!
Rene'




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Clear values

Simplify to

Range("D1:D376").Copy
With Range("C1:C376").
.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
.PasteSpecial Paste:=xlPasteValidation, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End With

To clear just values, not formulas, you have to test it

Dim cell As Range

For Each cell In Selection
If Not cell.HasFormula Then
cell.Value = ""
End If
Next cell


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Renee" wrote in message
...
Thanks for the reply

My code:
Range("D1:D376").Select
Selection.Copy
Range("C1:C376").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValidation, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

This is copying cell contents over to the new range. Also I forgot to ask
the original question of clearing values. If I select a range, can I

clear
only the values and not the formulas?
THanks for your help!
Renee
"Bob Phillips" wrote:

rng1.Copy
rng2.Pastespecial Paste:= xlPasteFormulas
rng2.Pastespecial Paste:= xlPasteFormats

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Rene'" wrote in message
...
Hi
I would like to copy a range and paste it elswhere but only formulas

ad
formats, without pasting the values that were int he copied range.

How
would
I do this?
Thanks!
Rene'






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Clear values

Thanks Bob
It still is copying the values. I just added the clear bit to it and its
working.
Thanks again!

"Bob Phillips" wrote:

Simplify to

Range("D1:D376").Copy
With Range("C1:C376").
.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
.PasteSpecial Paste:=xlPasteValidation, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End With

To clear just values, not formulas, you have to test it

Dim cell As Range

For Each cell In Selection
If Not cell.HasFormula Then
cell.Value = ""
End If
Next cell


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Renee" wrote in message
...
Thanks for the reply

My code:
Range("D1:D376").Select
Selection.Copy
Range("C1:C376").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValidation, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

This is copying cell contents over to the new range. Also I forgot to ask
the original question of clearing values. If I select a range, can I

clear
only the values and not the formulas?
THanks for your help!
Renee
"Bob Phillips" wrote:

rng1.Copy
rng2.Pastespecial Paste:= xlPasteFormulas
rng2.Pastespecial Paste:= xlPasteFormats

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Rene'" wrote in message
...
Hi
I would like to copy a range and paste it elswhere but only formulas

ad
formats, without pasting the values that were int he copied range.

How
would
I do this?
Thanks!
Rene'






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
Need help with macro to copy, paste, and clear cell values Anthony[_5_] Excel Discussion (Misc queries) 8 December 21st 09 02:11 PM
How to clear the lowest 10 values from a list of 30 values fap87 New Users to Excel 3 April 3rd 09 07:40 AM
Clear values but keep formulas? Gumby Excel Discussion (Misc queries) 1 June 30th 08 11:13 PM
Automatically clear values from a range of selected cells John Davies Excel Discussion (Misc queries) 1 June 28th 05 04:42 PM
How do I clear a worksheet of values, but leave formulas intact? [email protected] Excel Worksheet Functions 2 April 18th 05 05:53 PM


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

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

About Us

"It's about Microsoft Excel"