ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Macro Copy cells and pastes them in another sheet (https://www.excelbanter.com/excel-programming/446466-excel-macro-copy-cells-pastes-them-another-sheet.html)

sam99

Excel Macro Copy cells and pastes them in another sheet
 
1 Attachment(s)
Hi All,
I am trying to create a macro that copies cells and past C16, C18, C20, E16, E18, G16, G18 in another sheet (sheet1) in the next blank row and save the sheet( copy value only).
File is attached
Thanx for the help

Vacuum Sealed

Excel Macro Copy cells and pastes them in another sheet
 
On 1/07/2012 7:42 PM, sam99 wrote:
Hi All,
I am trying to create a macro that copies cells and past C16, C18, C20,
E16, E18, G16, G18 in another sheet (sheet1) in the next blank row and
save the sheet( copy value only).
File is attached
Thanx for the help


+-------------------------------------------------------------------+
|Filename: test macro.zip |
|Download: http://www.excelbanter.com/attachment.php?attachmentid=444|
+-------------------------------------------------------------------+



Hi

Here's a quick solution for you, not pretty, but it does what you want.

As you have not given the destination cells you will have to changed the
tSht.Range() refs to suit...

HTH
Mick.

Sub CopyCells()

Dim sSht As Worksheet, tSht As Worksheet

Set sSht = Worksheets("Ref1")
Set tSht = Worksheets("Sheet1")

tSht.Range("A2").Value = sSht.Range("C16").Value
tSht.Range("A3").Value = sSht.Range("C18").Value
tSht.Range("A4").Value = sSht.Range("C20").Value
tSht.Range("A5").Value = sSht.Range("E16").Value
tSht.Range("A6").Value = sSht.Range("E18").Value
tSht.Range("A7").Value = sSht.Range("G16").Value
tSht.Range("A8").Value = sSht.Range("G18").Value

End Sub



sam99

Thanx
it is solved and I cross posted this question but I didn't know I shouldn't do that.

Quote:

Originally Posted by Vacuum Sealed (Post 1603302)
On 1/07/2012 7:42 PM, sam99 wrote:
Hi All,
I am trying to create a macro that copies cells and past C16, C18, C20,
E16, E18, G16, G18 in another sheet (sheet1) in the next blank row and
save the sheet( copy value only).
File is attached
Thanx for the help


+-------------------------------------------------------------------+
|Filename: test macro.zip |
|Download: http://www.excelbanter.com/attachment.php?attachmentid=444|
+-------------------------------------------------------------------+



Hi

Here's a quick solution for you, not pretty, but it does what you want.

As you have not given the destination cells you will have to changed the
tSht.Range() refs to suit...

HTH
Mick.

Sub CopyCells()

Dim sSht As Worksheet, tSht As Worksheet

Set sSht = Worksheets("Ref1")
Set tSht = Worksheets("Sheet1")

tSht.Range("A2").Value = sSht.Range("C16").Value
tSht.Range("A3").Value = sSht.Range("C18").Value
tSht.Range("A4").Value = sSht.Range("C20").Value
tSht.Range("A5").Value = sSht.Range("E16").Value
tSht.Range("A6").Value = sSht.Range("E18").Value
tSht.Range("A7").Value = sSht.Range("G16").Value
tSht.Range("A8").Value = sSht.Range("G18").Value

End Sub



All times are GMT +1. The time now is 11:54 AM.

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