Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Moving Cell Values Instead of Formulas to Another Sheet

I would like to have a macro to so that with a push of a button, I can
move the values in cells A2:C2 to another spreadsheet (always that
range). When the values are changed, I would like to be able to hit
the same button and copy the new information to the next blank line on
the same sheet I copied to before.

I fould the following thread: http://tinyurl.com/2j9hg7

Sub copyfunction()

Dim fromrng As Range
Dim torng As Range

With Worksheets("Sheet1")
Set fromrng = .Range("a2:c2")
End With

With Worksheets("Sheet2")
Set torng = .Cells(.Cells.SpecialCells(xlLastCell).Row + 1,
"a")
End With

fromrng.Copy Destination:=torng

End Sub

This works great, but is there a way to change this so that when there
is a formula in cells A2:C2, the value will copy over instead of the
formula?

Also, as you can tell, I am a beginner at this kind of thing, but I
find myself having to rely on code more and more as I want to do more
complicated things. I'd appreciate any reference books or websites
that would help me learn. I don't like to just cut and paste code I
don't fully understand. Any help would be appreciated.

Thank You,

-Chad

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Moving Cell Values Instead of Formulas to Another Sheet

fromrng.copy
torng.pastespecial paste:=xlpastevalues

or just assign the values

torng.resize(fromrng.rows.count,fromrng.columns.co unt).value _
= fromrng.value



wrote:

I would like to have a macro to so that with a push of a button, I can
move the values in cells A2:C2 to another spreadsheet (always that
range). When the values are changed, I would like to be able to hit
the same button and copy the new information to the next blank line on
the same sheet I copied to before.

I fould the following thread:
http://tinyurl.com/2j9hg7

Sub copyfunction()

Dim fromrng As Range
Dim torng As Range

With Worksheets("Sheet1")
Set fromrng = .Range("a2:c2")
End With

With Worksheets("Sheet2")
Set torng = .Cells(.Cells.SpecialCells(xlLastCell).Row + 1,
"a")
End With

fromrng.Copy Destination:=torng

End Sub

This works great, but is there a way to change this so that when there
is a formula in cells A2:C2, the value will copy over instead of the
formula?

Also, as you can tell, I am a beginner at this kind of thing, but I
find myself having to rely on code more and more as I want to do more
complicated things. I'd appreciate any reference books or websites
that would help me learn. I don't like to just cut and paste code I
don't fully understand. Any help would be appreciated.

Thank You,

-Chad


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Moving Cell Values Instead of Formulas to Another Sheet

fromrng.Copy
torng.PasteSpecial xlPasteValues
Application.CutCopyMode = False

--
Jim
wrote in message
ups.com...
|I would like to have a macro to so that with a push of a button, I can
| move the values in cells A2:C2 to another spreadsheet (always that
| range). When the values are changed, I would like to be able to hit
| the same button and copy the new information to the next blank line on
| the same sheet I copied to before.
|
| I fould the following thread: http://tinyurl.com/2j9hg7
|
| Sub copyfunction()
|
| Dim fromrng As Range
| Dim torng As Range
|
| With Worksheets("Sheet1")
| Set fromrng = .Range("a2:c2")
| End With
|
| With Worksheets("Sheet2")
| Set torng = .Cells(.Cells.SpecialCells(xlLastCell).Row + 1,
| "a")
| End With
|
| fromrng.Copy Destination:=torng
|
| End Sub
|
| This works great, but is there a way to change this so that when there
| is a formula in cells A2:C2, the value will copy over instead of the
| formula?
|
| Also, as you can tell, I am a beginner at this kind of thing, but I
| find myself having to rely on code more and more as I want to do more
| complicated things. I'd appreciate any reference books or websites
| that would help me learn. I don't like to just cut and paste code I
| don't fully understand. Any help would be appreciated.
|
| Thank You,
|
| -Chad
|


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
Moving cell values wulfit New Users to Excel 7 June 26th 11 05:35 PM
Moving Formulas to a different sheet Farias Excel Discussion (Misc queries) 1 August 1st 08 12:37 AM
moving formulas from one sheet to another quiggly Excel Discussion (Misc queries) 0 April 22nd 08 04:35 PM
moving values from sheet to another makdaddy925 Excel Discussion (Misc queries) 1 December 8th 05 06:11 PM
moving values from one sheet to another makdaddy925 Excel Discussion (Misc queries) 2 December 8th 05 05:44 PM


All times are GMT +1. The time now is 02:52 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"