ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy question (https://www.excelbanter.com/excel-programming/342255-copy-question.html)

Gary Keramidas[_4_]

copy question
 
when you use the .copy method, is there any way to only copy formulas? or
do you have to use the paste method to achieve this?

this copies formats, too

Worksheets("Sheet1").Range("A1:D4").Copy _
destination:=Worksheets("Sheet2").Range("E5")


--


Gary




Gary Keramidas[_4_]

copy question
 
sorry, this should be values, not formulas

when you use the .copy method, is there any way to only copy values? or
do you have to use the paste method to achieve this?

--


Gary


"Gary Keramidas" wrote in message
...
when you use the .copy method, is there any way to only copy formulas? or
do you have to use the paste method to achieve this?

this copies formats, too

Worksheets("Sheet1").Range("A1:D4").Copy _
destination:=Worksheets("Sheet2").Range("E5")


--


Gary






Access101

copy question
 
Is this helpful:

Worksheets("Sheet1").Range("A1:D4").Select
Selection.Cells.SpecialCells(xlCellTypeFormulas).C opy
Destination:=Worksheets("Sheet1").Range("E5")


"Gary Keramidas" wrote:

when you use the .copy method, is there any way to only copy formulas? or
do you have to use the paste method to achieve this?

this copies formats, too

Worksheets("Sheet1").Range("A1:D4").Copy _
destination:=Worksheets("Sheet2").Range("E5")


--


Gary





Jim Thomlinson[_4_]

copy question
 
This copies only the cells with formulas... Not sure if that is what you
want...

Sub CopyFormulas()
Dim rng As Range

On Error Resume Next
Set rng = Sheet1.Range("A:A").SpecialCells(xlCellTypeFormula s)
On Error GoTo 0

If rng Is Nothing Then
MsgBox "nothing was found"
Else
rng.Copy
End If
End Sub

--
HTH...

Jim Thomlinson


"Gary Keramidas" wrote:

when you use the .copy method, is there any way to only copy formulas? or
do you have to use the paste method to achieve this?

this copies formats, too

Worksheets("Sheet1").Range("A1:D4").Copy _
destination:=Worksheets("Sheet2").Range("E5")


--


Gary





Jim Thomlinson[_4_]

copy question
 
Here it is for constants...

Sub CopyFormulas()
Dim rng As Range

On Error Resume Next
Set rng = Sheet1.Range("A:A").SpecialCells(xlCellTypeConstan ts)
On Error GoTo 0

If rng Is Nothing Then
MsgBox "nothing was found"
Else
rng.Copy
End If
End Sub
--
HTH...

Jim Thomlinson


"Jim Thomlinson" wrote:

This copies only the cells with formulas... Not sure if that is what you
want...

Sub CopyFormulas()
Dim rng As Range

On Error Resume Next
Set rng = Sheet1.Range("A:A").SpecialCells(xlCellTypeFormula s)
On Error GoTo 0

If rng Is Nothing Then
MsgBox "nothing was found"
Else
rng.Copy
End If
End Sub

--
HTH...

Jim Thomlinson


"Gary Keramidas" wrote:

when you use the .copy method, is there any way to only copy formulas? or
do you have to use the paste method to achieve this?

this copies formats, too

Worksheets("Sheet1").Range("A1:D4").Copy _
destination:=Worksheets("Sheet2").Range("E5")


--


Gary





Jake Marx[_3_]

copy question
 
Gary,

Gary Keramidas wrote:
sorry, this should be values, not formulas

when you use the .copy method, is there any way to only copy values? or do
you have to use the paste method to achieve this?


You could do a copy then paste special values. Or, you could just do
something like this:

Range("B1:B10").Value = Range("A1:A10").Value

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]



bill k

copy question
 

Sheet1.Select
Range("A1:d4").Copy
Sheet2.Select
Range("e5").PasteSpecial Paste:=xlPasteFormulas

should do the trick


--
bill k


------------------------------------------------------------------------
bill k's Profile: http://www.excelforum.com/member.php...nfo&userid=821
View this thread: http://www.excelforum.com/showthread...hreadid=474398


Gary Keramidas[_4_]

copy question
 
ok, thanks everyone for the replies. i have it now

--


Gary


"Gary Keramidas" wrote in message
...
when you use the .copy method, is there any way to only copy formulas? or
do you have to use the paste method to achieve this?

this copies formats, too

Worksheets("Sheet1").Range("A1:D4").Copy _
destination:=Worksheets("Sheet2").Range("E5")


--


Gary







All times are GMT +1. The time now is 01:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com