Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I will be very grateful for your help on this problem! I am very new to macros. I have data on "Sheet1" in cells A2:P3. These cells reference other cells on different tabs and the data changes day-to-day. So, I need a macro which copies & pastes (values only) the data in cells A2:P3 onto a new sheet ("CashTransferRecord"). Here is the hard part ... Each time I run the macro I would like the data to be pasted to the first two blank rows below the existing rows which already have data in them. Note: the first time the macro runs i would like the two rows of data it pastes onto "CashTransferRecord" to be pasted in rows 2 and 3. Can this be done?! Many Thank |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub cpy2rws()
lr = Worksheets("CashTransferRecord").Cells(Rows.Count, 1).End(xlUp).Row Worksheets("Sheet1").Range("$A$2:$P$3").Copy _ Worksheets("CashTransferRecord").Range("A" & lr + 1) End Sub "Brice" wrote: Hello, I will be very grateful for your help on this problem! I am very new to macros. I have data on "Sheet1" in cells A2:P3. These cells reference other cells on different tabs and the data changes day-to-day. So, I need a macro which copies & pastes (values only) the data in cells A2:P3 onto a new sheet ("CashTransferRecord"). Here is the hard part ... Each time I run the macro I would like the data to be pasted to the first two blank rows below the existing rows which already have data in them. Note: the first time the macro runs i would like the two rows of data it pastes onto "CashTransferRecord" to be pasted in rows 2 and 3. Can this be done?! Many Thank |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Disregard the first one. It will copy everything over. This one only does
values. Sub cpy2rws() lr = Worksheets("CashTransferRecord").Cells(Rows.Count, 1).End(xlUp).Row Worksheets("Sheet1").Range("$A$2:$P$3").Copy Worksheets("CashTransferRecord").Range("A" & lr + 1).PasteSpecial _ Paste:=xlValues End Sub "Brice" wrote: Hello, I will be very grateful for your help on this problem! I am very new to macros. I have data on "Sheet1" in cells A2:P3. These cells reference other cells on different tabs and the data changes day-to-day. So, I need a macro which copies & pastes (values only) the data in cells A2:P3 onto a new sheet ("CashTransferRecord"). Here is the hard part ... Each time I run the macro I would like the data to be pasted to the first two blank rows below the existing rows which already have data in them. Note: the first time the macro runs i would like the two rows of data it pastes onto "CashTransferRecord" to be pasted in rows 2 and 3. Can this be done?! Many Thank |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for your help.
When I run the macro for the second time, the data is overwriting the existing data in rows two and three. I would likle to have the macro ADD the data/record to the next available rows so that I can keep an ongoign database. Can you help? "JLGWhiz" wrote: Disregard the first one. It will copy everything over. This one only does values. Sub cpy2rws() lr = Worksheets("CashTransferRecord").Cells(Rows.Count, 1).End(xlUp).Row Worksheets("Sheet1").Range("$A$2:$P$3").Copy Worksheets("CashTransferRecord").Range("A" & lr + 1).PasteSpecial _ Paste:=xlValues End Sub "Brice" wrote: Hello, I will be very grateful for your help on this problem! I am very new to macros. I have data on "Sheet1" in cells A2:P3. These cells reference other cells on different tabs and the data changes day-to-day. So, I need a macro which copies & pastes (values only) the data in cells A2:P3 onto a new sheet ("CashTransferRecord"). Here is the hard part ... Each time I run the macro I would like the data to be pasted to the first two blank rows below the existing rows which already have data in them. Note: the first time the macro runs i would like the two rows of data it pastes onto "CashTransferRecord" to be pasted in rows 2 and 3. Can this be done?! Many Thank |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can someone help me with this MACRO problem?
"Brice" wrote: Thanks for your help. When I run the macro for the second time, the data is overwriting the existing data in rows two and three. I would like to have the macro ADD the data/record to the next available rows so that I can keep an ongoign database. Can you help? "JLGWhiz" wrote: Disregard the first one. It will copy everything over. This one only does values. Sub cpy2rws() lr = Worksheets("CashTransferRecord").Cells(Rows.Count, 1).End(xlUp).Row Worksheets("Sheet1").Range("$A$2:$P$3").Copy Worksheets("CashTransferRecord").Range("A" & lr + 1).PasteSpecial _ Paste:=xlValues End Sub "Brice" wrote: Hello, I will be very grateful for your help on this problem! I am very new to macros. I have data on "Sheet1" in cells A2:P3. These cells reference other cells on different tabs and the data changes day-to-day. So, I need a macro which copies & pastes (values only) the data in cells A2:P3 onto a new sheet ("CashTransferRecord"). Here is the hard part ... Each time I run the macro I would like the data to be pasted to the first two blank rows below the existing rows which already have data in them. Note: the first time the macro runs i would like the two rows of data it pastes onto "CashTransferRecord" to be pasted in rows 2 and 3. Can this be done?! Many Thank |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Brice
Worksheets("Sheet1").Range("$A$2:$P$3").Copy Worksheets("CashTransferRecord").Range("A65000").E nd(xlUp).Offset(2, 0).Cells.PasteSpecial (xlPasteValues) Regards JY "Brice" wrote in message ... Can someone help me with this MACRO problem? "Brice" wrote: Thanks for your help. When I run the macro for the second time, the data is overwriting the existing data in rows two and three. I would like to have the macro ADD the data/record to the next available rows so that I can keep an ongoign database. Can you help? "JLGWhiz" wrote: Disregard the first one. It will copy everything over. This one only does values. Sub cpy2rws() lr = Worksheets("CashTransferRecord").Cells(Rows.Count, 1).End(xlUp).Row Worksheets("Sheet1").Range("$A$2:$P$3").Copy Worksheets("CashTransferRecord").Range("A" & lr + 1).PasteSpecial _ Paste:=xlValues End Sub "Brice" wrote: Hello, I will be very grateful for your help on this problem! I am very new to macros. I have data on "Sheet1" in cells A2:P3. These cells reference other cells on different tabs and the data changes day-to-day. So, I need a macro which copies & pastes (values only) the data in cells A2:P3 onto a new sheet ("CashTransferRecord"). Here is the hard part ... Each time I run the macro I would like the data to be pasted to the first two blank rows below the existing rows which already have data in them. Note: the first time the macro runs i would like the two rows of data it pastes onto "CashTransferRecord" to be pasted in rows 2 and 3. Can this be done?! Many Thank |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Actually you'd have to do this because of your requirement to have the data
start on row 2 if you're just starting out. And the offset # was wrong, sb 1 not 2. HTH Sub Doit() Sheets("CashTransferRecord").Select If Cells(2, 1).Value = Empty Then Worksheets("Sheet1").Range("$A$2:$P$3").Copy Worksheets("CashTransferRecord").Range("a2").Paste Special (xlPasteValues) Else Worksheets("Sheet1").Range("$A$2:$P$3").Copy Worksheets("CashTransferRecord").Range("A65000").E nd(xlUp).Offset(1, 0).Cells.PasteSpecial (xlPasteValues) End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel trend line equation does not generate correct results | Excel Discussion (Misc queries) | |||
How to generate a worksheet out of an Excel 2003 database? | Excel Worksheet Functions | |||
How can I generate avery address labels from database | New Users to Excel | |||
Using For/Next Loop To Generate 4 CommandButtons On A UserForm Results In A Runtime Error 91 | Excel Programming | |||
How to generate a file copy of the Excel Find results list | Excel Programming |