Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying from one cell to another cell
Basically the procedure involves me copying a value from Cell C3 from Sheet3
into a Range of cells on Sheet1, the reason why I don't specify the cells on Sheet1 is because I am not only copying into one cell on Sheet1. Sheet3 is basically updated everyday, so I basically want to copy the values from the cell in Sheet3 into Sheet1 but not overwriting the data that is already just basically adding to the data that is already there, the column that I'm copying the data into is Column D on Sheet1. I basically want to do the samething for Sheet3 Cell C4, basically copying data from that cell into column E on Sheet1, and also doing the samething for Sheet4, copying Cell C3 from Sheet4 into column H on Sheet1. There is already data on Sheet1 so I would just like to add to what is already there without overwriting anything. I recorded a macro, which you can see below: Sub Macro2() Sheets("Sheet3").Select Range("C3").Select Selection.Copy Sheets("Sheet1").Select Range("D8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet3").Select Range("C4").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("E8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet4").Select Range("C3").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("H8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False ActiveWorkbook.Save End Sub Basically the macro only works for one cell, but it overwrites the data that is already within the cells on sheet1, I just want it to add to that data that is already there, so if you can help me with this it would be greatly appreciated, thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying from one cell to another cell
Basically I want to copy the values into one cell at a time, every day I
would come in and update the sheet, so I want to copy the data from the source sheet into cells on the destination sheet. Not overwriting anything just adding to the data that is already there, for instance, if there is data already in D8 that was added from the previous day, today when I get in and update the source sheets, I want to copy the data automatically into D9 and the same process goes on each day, D10, D11 and so on. "Nigel" wrote: If I understand you correctly.. You have a value on Sheet3 Range C3 and Range C4 (the source) which you wish to add to the values already in Sheet1 Column D or Column E (the target). How do you wish to specify the target range? The whole of column D and E or something else? Should be straightforward given the conditions. Post your specifc needs -- Regards, Nigel "drinese18" wrote in message ... Basically the procedure involves me copying a value from Cell C3 from Sheet3 into a Range of cells on Sheet1, the reason why I don't specify the cells on Sheet1 is because I am not only copying into one cell on Sheet1. Sheet3 is basically updated everyday, so I basically want to copy the values from the cell in Sheet3 into Sheet1 but not overwriting the data that is already just basically adding to the data that is already there, the column that I'm copying the data into is Column D on Sheet1. I basically want to do the samething for Sheet3 Cell C4, basically copying data from that cell into column E on Sheet1, and also doing the samething for Sheet4, copying Cell C3 from Sheet4 into column H on Sheet1. There is already data on Sheet1 so I would just like to add to what is already there without overwriting anything. I recorded a macro, which you can see below: Sub Macro2() Sheets("Sheet3").Select Range("C3").Select Selection.Copy Sheets("Sheet1").Select Range("D8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet3").Select Range("C4").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("E8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet4").Select Range("C3").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("H8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False ActiveWorkbook.Save End Sub Basically the macro only works for one cell, but it overwrites the data that is already within the cells on sheet1, I just want it to add to that data that is already there, so if you can help me with this it would be greatly appreciated, thanks |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying from one cell to another cell
Sub CopyData()
With Sheets("Sheet1") .Range("D" & .Cells(.Rows.Count, "D").End(xlUp).Row + 1) = Sheets("Sheet3").Range("C3") .Range("E" & .Cells(.Rows.Count, "E").End(xlUp).Row + 1) = Sheets("Sheet3").Range("C4") End With End Sub -- Regards, Nigel "drinese18" wrote in message ... Basically I want to copy the values into one cell at a time, every day I would come in and update the sheet, so I want to copy the data from the source sheet into cells on the destination sheet. Not overwriting anything just adding to the data that is already there, for instance, if there is data already in D8 that was added from the previous day, today when I get in and update the source sheets, I want to copy the data automatically into D9 and the same process goes on each day, D10, D11 and so on. "Nigel" wrote: If I understand you correctly.. You have a value on Sheet3 Range C3 and Range C4 (the source) which you wish to add to the values already in Sheet1 Column D or Column E (the target). How do you wish to specify the target range? The whole of column D and E or something else? Should be straightforward given the conditions. Post your specifc needs -- Regards, Nigel "drinese18" wrote in message ... Basically the procedure involves me copying a value from Cell C3 from Sheet3 into a Range of cells on Sheet1, the reason why I don't specify the cells on Sheet1 is because I am not only copying into one cell on Sheet1. Sheet3 is basically updated everyday, so I basically want to copy the values from the cell in Sheet3 into Sheet1 but not overwriting the data that is already just basically adding to the data that is already there, the column that I'm copying the data into is Column D on Sheet1. I basically want to do the samething for Sheet3 Cell C4, basically copying data from that cell into column E on Sheet1, and also doing the samething for Sheet4, copying Cell C3 from Sheet4 into column H on Sheet1. There is already data on Sheet1 so I would just like to add to what is already there without overwriting anything. I recorded a macro, which you can see below: Sub Macro2() Sheets("Sheet3").Select Range("C3").Select Selection.Copy Sheets("Sheet1").Select Range("D8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet3").Select Range("C4").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("E8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet4").Select Range("C3").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("H8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False ActiveWorkbook.Save End Sub Basically the macro only works for one cell, but it overwrites the data that is already within the cells on sheet1, I just want it to add to that data that is already there, so if you can help me with this it would be greatly appreciated, thanks |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying from one cell to another cell
Its basically bringing up an error for the .Range statements, are they
suppose to be in the same line? "Nigel" wrote: Sub CopyData() With Sheets("Sheet1") .Range("D" & .Cells(.Rows.Count, "D").End(xlUp).Row + 1) = Sheets("Sheet3").Range("C3") .Range("E" & .Cells(.Rows.Count, "E").End(xlUp).Row + 1) = Sheets("Sheet3").Range("C4") End With End Sub -- Regards, Nigel "drinese18" wrote in message ... Basically I want to copy the values into one cell at a time, every day I would come in and update the sheet, so I want to copy the data from the source sheet into cells on the destination sheet. Not overwriting anything just adding to the data that is already there, for instance, if there is data already in D8 that was added from the previous day, today when I get in and update the source sheets, I want to copy the data automatically into D9 and the same process goes on each day, D10, D11 and so on. "Nigel" wrote: If I understand you correctly.. You have a value on Sheet3 Range C3 and Range C4 (the source) which you wish to add to the values already in Sheet1 Column D or Column E (the target). How do you wish to specify the target range? The whole of column D and E or something else? Should be straightforward given the conditions. Post your specifc needs -- Regards, Nigel "drinese18" wrote in message ... Basically the procedure involves me copying a value from Cell C3 from Sheet3 into a Range of cells on Sheet1, the reason why I don't specify the cells on Sheet1 is because I am not only copying into one cell on Sheet1. Sheet3 is basically updated everyday, so I basically want to copy the values from the cell in Sheet3 into Sheet1 but not overwriting the data that is already just basically adding to the data that is already there, the column that I'm copying the data into is Column D on Sheet1. I basically want to do the samething for Sheet3 Cell C4, basically copying data from that cell into column E on Sheet1, and also doing the samething for Sheet4, copying Cell C3 from Sheet4 into column H on Sheet1. There is already data on Sheet1 so I would just like to add to what is already there without overwriting anything. I recorded a macro, which you can see below: Sub Macro2() Sheets("Sheet3").Select Range("C3").Select Selection.Copy Sheets("Sheet1").Select Range("D8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet3").Select Range("C4").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("E8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet4").Select Range("C3").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("H8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False ActiveWorkbook.Save End Sub Basically the macro only works for one cell, but it overwrites the data that is already within the cells on sheet1, I just want it to add to that data that is already there, so if you can help me with this it would be greatly appreciated, thanks |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying from one cell to another cell
Yes, the wrap occurs in the newsgroup reader....
-- Regards, Nigel "drinese18" wrote in message ... Its basically bringing up an error for the .Range statements, are they suppose to be in the same line? "Nigel" wrote: Sub CopyData() With Sheets("Sheet1") .Range("D" & .Cells(.Rows.Count, "D").End(xlUp).Row + 1) = Sheets("Sheet3").Range("C3") .Range("E" & .Cells(.Rows.Count, "E").End(xlUp).Row + 1) = Sheets("Sheet3").Range("C4") End With End Sub -- Regards, Nigel "drinese18" wrote in message ... Basically I want to copy the values into one cell at a time, every day I would come in and update the sheet, so I want to copy the data from the source sheet into cells on the destination sheet. Not overwriting anything just adding to the data that is already there, for instance, if there is data already in D8 that was added from the previous day, today when I get in and update the source sheets, I want to copy the data automatically into D9 and the same process goes on each day, D10, D11 and so on. "Nigel" wrote: If I understand you correctly.. You have a value on Sheet3 Range C3 and Range C4 (the source) which you wish to add to the values already in Sheet1 Column D or Column E (the target). How do you wish to specify the target range? The whole of column D and E or something else? Should be straightforward given the conditions. Post your specifc needs -- Regards, Nigel "drinese18" wrote in message ... Basically the procedure involves me copying a value from Cell C3 from Sheet3 into a Range of cells on Sheet1, the reason why I don't specify the cells on Sheet1 is because I am not only copying into one cell on Sheet1. Sheet3 is basically updated everyday, so I basically want to copy the values from the cell in Sheet3 into Sheet1 but not overwriting the data that is already just basically adding to the data that is already there, the column that I'm copying the data into is Column D on Sheet1. I basically want to do the samething for Sheet3 Cell C4, basically copying data from that cell into column E on Sheet1, and also doing the samething for Sheet4, copying Cell C3 from Sheet4 into column H on Sheet1. There is already data on Sheet1 so I would just like to add to what is already there without overwriting anything. I recorded a macro, which you can see below: Sub Macro2() Sheets("Sheet3").Select Range("C3").Select Selection.Copy Sheets("Sheet1").Select Range("D8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet3").Select Range("C4").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("E8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet4").Select Range("C3").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("H8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False ActiveWorkbook.Save End Sub Basically the macro only works for one cell, but it overwrites the data that is already within the cells on sheet1, I just want it to add to that data that is already there, so if you can help me with this it would be greatly appreciated, thanks |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying from one cell to another cell
Ok I tested it but it's still bringing up an error, the error message
basically says Object doesn't support this property or method, dunno what I'm doing wrong "Nigel" wrote: Yes, the wrap occurs in the newsgroup reader.... -- Regards, Nigel "drinese18" wrote in message ... Its basically bringing up an error for the .Range statements, are they suppose to be in the same line? "Nigel" wrote: Sub CopyData() With Sheets("Sheet1") .Range("D" & .Cells(.Rows.Count, "D").End(xlUp).Row + 1) = Sheets("Sheet3").Range("C3") .Range("E" & .Cells(.Rows.Count, "E").End(xlUp).Row + 1) = Sheets("Sheet3").Range("C4") End With End Sub -- Regards, Nigel "drinese18" wrote in message ... Basically I want to copy the values into one cell at a time, every day I would come in and update the sheet, so I want to copy the data from the source sheet into cells on the destination sheet. Not overwriting anything just adding to the data that is already there, for instance, if there is data already in D8 that was added from the previous day, today when I get in and update the source sheets, I want to copy the data automatically into D9 and the same process goes on each day, D10, D11 and so on. "Nigel" wrote: If I understand you correctly.. You have a value on Sheet3 Range C3 and Range C4 (the source) which you wish to add to the values already in Sheet1 Column D or Column E (the target). How do you wish to specify the target range? The whole of column D and E or something else? Should be straightforward given the conditions. Post your specifc needs -- Regards, Nigel "drinese18" wrote in message ... Basically the procedure involves me copying a value from Cell C3 from Sheet3 into a Range of cells on Sheet1, the reason why I don't specify the cells on Sheet1 is because I am not only copying into one cell on Sheet1. Sheet3 is basically updated everyday, so I basically want to copy the values from the cell in Sheet3 into Sheet1 but not overwriting the data that is already just basically adding to the data that is already there, the column that I'm copying the data into is Column D on Sheet1. I basically want to do the samething for Sheet3 Cell C4, basically copying data from that cell into column E on Sheet1, and also doing the samething for Sheet4, copying Cell C3 from Sheet4 into column H on Sheet1. There is already data on Sheet1 so I would just like to add to what is already there without overwriting anything. I recorded a macro, which you can see below: Sub Macro2() Sheets("Sheet3").Select Range("C3").Select Selection.Copy Sheets("Sheet1").Select Range("D8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet3").Select Range("C4").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("E8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet4").Select Range("C3").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("H8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False ActiveWorkbook.Save End Sub Basically the macro only works for one cell, but it overwrites the data that is already within the cells on sheet1, I just want it to add to that data that is already there, so if you can help me with this it would be greatly appreciated, thanks |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying from one cell to another cell
Do you have a Sheets named, Sheet1 and Sheet3 - they appear in the sheet
tabs? Are the sheets unprotected? On what line is the error occurring? -- Regards, Nigel "drinese18" wrote in message ... Ok I tested it but it's still bringing up an error, the error message basically says Object doesn't support this property or method, dunno what I'm doing wrong "Nigel" wrote: Yes, the wrap occurs in the newsgroup reader.... -- Regards, Nigel "drinese18" wrote in message ... Its basically bringing up an error for the .Range statements, are they suppose to be in the same line? "Nigel" wrote: Sub CopyData() With Sheets("Sheet1") .Range("D" & .Cells(.Rows.Count, "D").End(xlUp).Row + 1) = Sheets("Sheet3").Range("C3") .Range("E" & .Cells(.Rows.Count, "E").End(xlUp).Row + 1) = Sheets("Sheet3").Range("C4") End With End Sub -- Regards, Nigel "drinese18" wrote in message ... Basically I want to copy the values into one cell at a time, every day I would come in and update the sheet, so I want to copy the data from the source sheet into cells on the destination sheet. Not overwriting anything just adding to the data that is already there, for instance, if there is data already in D8 that was added from the previous day, today when I get in and update the source sheets, I want to copy the data automatically into D9 and the same process goes on each day, D10, D11 and so on. "Nigel" wrote: If I understand you correctly.. You have a value on Sheet3 Range C3 and Range C4 (the source) which you wish to add to the values already in Sheet1 Column D or Column E (the target). How do you wish to specify the target range? The whole of column D and E or something else? Should be straightforward given the conditions. Post your specifc needs -- Regards, Nigel "drinese18" wrote in message ... Basically the procedure involves me copying a value from Cell C3 from Sheet3 into a Range of cells on Sheet1, the reason why I don't specify the cells on Sheet1 is because I am not only copying into one cell on Sheet1. Sheet3 is basically updated everyday, so I basically want to copy the values from the cell in Sheet3 into Sheet1 but not overwriting the data that is already just basically adding to the data that is already there, the column that I'm copying the data into is Column D on Sheet1. I basically want to do the samething for Sheet3 Cell C4, basically copying data from that cell into column E on Sheet1, and also doing the samething for Sheet4, copying Cell C3 from Sheet4 into column H on Sheet1. There is already data on Sheet1 so I would just like to add to what is already there without overwriting anything. I recorded a macro, which you can see below: Sub Macro2() Sheets("Sheet3").Select Range("C3").Select Selection.Copy Sheets("Sheet1").Select Range("D8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet3").Select Range("C4").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("E8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet4").Select Range("C3").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("H8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False ActiveWorkbook.Save End Sub Basically the macro only works for one cell, but it overwrites the data that is already within the cells on sheet1, I just want it to add to that data that is already there, so if you can help me with this it would be greatly appreciated, thanks |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying from one cell to another cell
The error basically comes up in this line:
"Sheets("IndexVal").Range("C3").Range ("E" & Cells(Rows.Count, "E").End(xlUp).Row + 1)" The name of the sheet which is Sheet 3 is IndexVal and sheet 1 is the Main, does it allow it to copy because I don't see any copypaste method within the code "Nigel" wrote: Do you have a Sheets named, Sheet1 and Sheet3 - they appear in the sheet tabs? Are the sheets unprotected? On what line is the error occurring? -- Regards, Nigel "drinese18" wrote in message ... Ok I tested it but it's still bringing up an error, the error message basically says Object doesn't support this property or method, dunno what I'm doing wrong "Nigel" wrote: Yes, the wrap occurs in the newsgroup reader.... -- Regards, Nigel "drinese18" wrote in message ... Its basically bringing up an error for the .Range statements, are they suppose to be in the same line? "Nigel" wrote: Sub CopyData() With Sheets("Sheet1") .Range("D" & .Cells(.Rows.Count, "D").End(xlUp).Row + 1) = Sheets("Sheet3").Range("C3") .Range("E" & .Cells(.Rows.Count, "E").End(xlUp).Row + 1) = Sheets("Sheet3").Range("C4") End With End Sub -- Regards, Nigel "drinese18" wrote in message ... Basically I want to copy the values into one cell at a time, every day I would come in and update the sheet, so I want to copy the data from the source sheet into cells on the destination sheet. Not overwriting anything just adding to the data that is already there, for instance, if there is data already in D8 that was added from the previous day, today when I get in and update the source sheets, I want to copy the data automatically into D9 and the same process goes on each day, D10, D11 and so on. "Nigel" wrote: If I understand you correctly.. You have a value on Sheet3 Range C3 and Range C4 (the source) which you wish to add to the values already in Sheet1 Column D or Column E (the target). How do you wish to specify the target range? The whole of column D and E or something else? Should be straightforward given the conditions. Post your specifc needs -- Regards, Nigel "drinese18" wrote in message ... Basically the procedure involves me copying a value from Cell C3 from Sheet3 into a Range of cells on Sheet1, the reason why I don't specify the cells on Sheet1 is because I am not only copying into one cell on Sheet1. Sheet3 is basically updated everyday, so I basically want to copy the values from the cell in Sheet3 into Sheet1 but not overwriting the data that is already just basically adding to the data that is already there, the column that I'm copying the data into is Column D on Sheet1. I basically want to do the samething for Sheet3 Cell C4, basically copying data from that cell into column E on Sheet1, and also doing the samething for Sheet4, copying Cell C3 from Sheet4 into column H on Sheet1. There is already data on Sheet1 so I would just like to add to what is already there without overwriting anything. I recorded a macro, which you can see below: Sub Macro2() Sheets("Sheet3").Select Range("C3").Select Selection.Copy Sheets("Sheet1").Select Range("D8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet3").Select Range("C4").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("E8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet4").Select Range("C3").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("H8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False ActiveWorkbook.Save End Sub Basically the macro only works for one cell, but it overwrites the data that is already within the cells on sheet1, I just want it to add to that data that is already there, so if you can help me with this it would be greatly appreciated, thanks |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying from one cell to another cell
That's a bit different to the code I supplied!
Just change where it said Sheet1 with Main and Sheet3 with IndexVal, there is no need to use copy paste as we are assigning the values directly. Sub CopyData() With Sheets("Main") .Range("D" & .Cells(.Rows.Count, "D").End(xlUp).Row + 1) _ = Sheets("IndexVal").Range("C3") .Range("E" & .Cells(.Rows.Count, "E").End(xlUp).Row + 1) _ = Sheets("IndexVal").Range("C4" End With End Sub Note: I have added continuation to avoid the wraps -- Regards, Nigel "drinese18" wrote in message ... The error basically comes up in this line: "Sheets("IndexVal").Range("C3").Range ("E" & Cells(Rows.Count, "E").End(xlUp).Row + 1)" The name of the sheet which is Sheet 3 is IndexVal and sheet 1 is the Main, does it allow it to copy because I don't see any copypaste method within the code "Nigel" wrote: Do you have a Sheets named, Sheet1 and Sheet3 - they appear in the sheet tabs? Are the sheets unprotected? On what line is the error occurring? -- Regards, Nigel "drinese18" wrote in message ... Ok I tested it but it's still bringing up an error, the error message basically says Object doesn't support this property or method, dunno what I'm doing wrong "Nigel" wrote: Yes, the wrap occurs in the newsgroup reader.... -- Regards, Nigel "drinese18" wrote in message ... Its basically bringing up an error for the .Range statements, are they suppose to be in the same line? "Nigel" wrote: Sub CopyData() With Sheets("Sheet1") .Range("D" & .Cells(.Rows.Count, "D").End(xlUp).Row + 1) = Sheets("Sheet3").Range("C3") .Range("E" & .Cells(.Rows.Count, "E").End(xlUp).Row + 1) = Sheets("Sheet3").Range("C4") End With End Sub -- Regards, Nigel "drinese18" wrote in message ... Basically I want to copy the values into one cell at a time, every day I would come in and update the sheet, so I want to copy the data from the source sheet into cells on the destination sheet. Not overwriting anything just adding to the data that is already there, for instance, if there is data already in D8 that was added from the previous day, today when I get in and update the source sheets, I want to copy the data automatically into D9 and the same process goes on each day, D10, D11 and so on. "Nigel" wrote: If I understand you correctly.. You have a value on Sheet3 Range C3 and Range C4 (the source) which you wish to add to the values already in Sheet1 Column D or Column E (the target). How do you wish to specify the target range? The whole of column D and E or something else? Should be straightforward given the conditions. Post your specifc needs -- Regards, Nigel "drinese18" wrote in message ... Basically the procedure involves me copying a value from Cell C3 from Sheet3 into a Range of cells on Sheet1, the reason why I don't specify the cells on Sheet1 is because I am not only copying into one cell on Sheet1. Sheet3 is basically updated everyday, so I basically want to copy the values from the cell in Sheet3 into Sheet1 but not overwriting the data that is already just basically adding to the data that is already there, the column that I'm copying the data into is Column D on Sheet1. I basically want to do the samething for Sheet3 Cell C4, basically copying data from that cell into column E on Sheet1, and also doing the samething for Sheet4, copying Cell C3 from Sheet4 into column H on Sheet1. There is already data on Sheet1 so I would just like to add to what is already there without overwriting anything. I recorded a macro, which you can see below: Sub Macro2() Sheets("Sheet3").Select Range("C3").Select Selection.Copy Sheets("Sheet1").Select Range("D8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet3").Select Range("C4").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("E8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet4").Select Range("C3").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("H8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False ActiveWorkbook.Save End Sub Basically the macro only works for one cell, but it overwrites the data that is already within the cells on sheet1, I just want it to add to that data that is already there, so if you can help me with this it would be greatly appreciated, thanks |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying from one cell to another cell
Well it didn't bring up any errors but it didn't work, it didn't copy the
values from IndexVal to Main, I mean the values are already on IndexVal just want to basically copy the values that are in the sheet IndexVal to the Main sheet. The values when they are downloaded are saved within the cell C3, when the value has been downloaded there, I basically copy and paste the value from IndexVal!C3 into Main column D, now the values have to be updated on a daily basis, thats what I'm saying that it should just add to whatever value that is already on the sheet, for instance I have column D which contains different values based on the date they were copied in the Column on the Main sheet. So for Friday I had 5000, for today when I download the values again from our database into IndexVal, I have to copy tthe data there into the Main sheet in Column D. I just want to copy and paste values from one cell to another cell without overwriting any data on the sheet. Please if you could help me with this it would be extremely great, thanks "Nigel" wrote: That's a bit different to the code I supplied! Just change where it said Sheet1 with Main and Sheet3 with IndexVal, there is no need to use copy paste as we are assigning the values directly. Sub CopyData() With Sheets("Main") .Range("D" & .Cells(.Rows.Count, "D").End(xlUp).Row + 1) _ = Sheets("IndexVal").Range("C3") .Range("E" & .Cells(.Rows.Count, "E").End(xlUp).Row + 1) _ = Sheets("IndexVal").Range("C4" End With End Sub Note: I have added continuation to avoid the wraps -- Regards, Nigel "drinese18" wrote in message ... The error basically comes up in this line: "Sheets("IndexVal").Range("C3").Range ("E" & Cells(Rows.Count, "E").End(xlUp).Row + 1)" The name of the sheet which is Sheet 3 is IndexVal and sheet 1 is the Main, does it allow it to copy because I don't see any copypaste method within the code "Nigel" wrote: Do you have a Sheets named, Sheet1 and Sheet3 - they appear in the sheet tabs? Are the sheets unprotected? On what line is the error occurring? -- Regards, Nigel "drinese18" wrote in message ... Ok I tested it but it's still bringing up an error, the error message basically says Object doesn't support this property or method, dunno what I'm doing wrong "Nigel" wrote: Yes, the wrap occurs in the newsgroup reader.... -- Regards, Nigel "drinese18" wrote in message ... Its basically bringing up an error for the .Range statements, are they suppose to be in the same line? "Nigel" wrote: Sub CopyData() With Sheets("Sheet1") .Range("D" & .Cells(.Rows.Count, "D").End(xlUp).Row + 1) = Sheets("Sheet3").Range("C3") .Range("E" & .Cells(.Rows.Count, "E").End(xlUp).Row + 1) = Sheets("Sheet3").Range("C4") End With End Sub -- Regards, Nigel "drinese18" wrote in message ... Basically I want to copy the values into one cell at a time, every day I would come in and update the sheet, so I want to copy the data from the source sheet into cells on the destination sheet. Not overwriting anything just adding to the data that is already there, for instance, if there is data already in D8 that was added from the previous day, today when I get in and update the source sheets, I want to copy the data automatically into D9 and the same process goes on each day, D10, D11 and so on. "Nigel" wrote: If I understand you correctly.. You have a value on Sheet3 Range C3 and Range C4 (the source) which you wish to add to the values already in Sheet1 Column D or Column E (the target). How do you wish to specify the target range? The whole of column D and E or something else? Should be straightforward given the conditions. Post your specifc needs -- Regards, Nigel "drinese18" wrote in message ... Basically the procedure involves me copying a value from Cell C3 from Sheet3 into a Range of cells on Sheet1, the reason why I don't specify the cells on Sheet1 is because I am not only copying into one cell on Sheet1. Sheet3 is basically updated everyday, so I basically want to copy the values from the cell in Sheet3 into Sheet1 but not overwriting the data that is already just basically adding to the data that is already there, the column that I'm copying the data into is Column D on Sheet1. I basically want to do the samething for Sheet3 Cell C4, basically copying data from that cell into column E on Sheet1, and also doing the samething for Sheet4, copying Cell C3 from Sheet4 into column H on Sheet1. There is already data on Sheet1 so I would just like to add to what is already there without overwriting anything. I recorded a macro, which you can see below: Sub Macro2() Sheets("Sheet3").Select Range("C3").Select Selection.Copy Sheets("Sheet1").Select Range("D8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet3").Select Range("C4").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("E8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet4").Select Range("C3").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("H8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False ActiveWorkbook.Save End Sub Basically the macro only works for one cell, but it overwrites the data that is already within the cells on sheet1, I just want it to add to that data that is already there, so if you can help me with this it would be greatly appreciated, thanks |
#12
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying from one cell to another cell
The code I supplied does work as follows, it takes the value on IndexVal!C3
and put it in the next empty row in Sheet Main column D, and Cell C4 into next empty cell in Main Column E. If that is what you want ? -- Regards, Nigel "drinese18" wrote in message ... Well it didn't bring up any errors but it didn't work, it didn't copy the values from IndexVal to Main, I mean the values are already on IndexVal just want to basically copy the values that are in the sheet IndexVal to the Main sheet. The values when they are downloaded are saved within the cell C3, when the value has been downloaded there, I basically copy and paste the value from IndexVal!C3 into Main column D, now the values have to be updated on a daily basis, thats what I'm saying that it should just add to whatever value that is already on the sheet, for instance I have column D which contains different values based on the date they were copied in the Column on the Main sheet. So for Friday I had 5000, for today when I download the values again from our database into IndexVal, I have to copy tthe data there into the Main sheet in Column D. I just want to copy and paste values from one cell to another cell without overwriting any data on the sheet. Please if you could help me with this it would be extremely great, thanks "Nigel" wrote: That's a bit different to the code I supplied! Just change where it said Sheet1 with Main and Sheet3 with IndexVal, there is no need to use copy paste as we are assigning the values directly. Sub CopyData() With Sheets("Main") .Range("D" & .Cells(.Rows.Count, "D").End(xlUp).Row + 1) _ = Sheets("IndexVal").Range("C3") .Range("E" & .Cells(.Rows.Count, "E").End(xlUp).Row + 1) _ = Sheets("IndexVal").Range("C4" End With End Sub Note: I have added continuation to avoid the wraps -- Regards, Nigel "drinese18" wrote in message ... The error basically comes up in this line: "Sheets("IndexVal").Range("C3").Range ("E" & Cells(Rows.Count, "E").End(xlUp).Row + 1)" The name of the sheet which is Sheet 3 is IndexVal and sheet 1 is the Main, does it allow it to copy because I don't see any copypaste method within the code "Nigel" wrote: Do you have a Sheets named, Sheet1 and Sheet3 - they appear in the sheet tabs? Are the sheets unprotected? On what line is the error occurring? -- Regards, Nigel "drinese18" wrote in message ... Ok I tested it but it's still bringing up an error, the error message basically says Object doesn't support this property or method, dunno what I'm doing wrong "Nigel" wrote: Yes, the wrap occurs in the newsgroup reader.... -- Regards, Nigel "drinese18" wrote in message ... Its basically bringing up an error for the .Range statements, are they suppose to be in the same line? "Nigel" wrote: Sub CopyData() With Sheets("Sheet1") .Range("D" & .Cells(.Rows.Count, "D").End(xlUp).Row + 1) = Sheets("Sheet3").Range("C3") .Range("E" & .Cells(.Rows.Count, "E").End(xlUp).Row + 1) = Sheets("Sheet3").Range("C4") End With End Sub -- Regards, Nigel "drinese18" wrote in message ... Basically I want to copy the values into one cell at a time, every day I would come in and update the sheet, so I want to copy the data from the source sheet into cells on the destination sheet. Not overwriting anything just adding to the data that is already there, for instance, if there is data already in D8 that was added from the previous day, today when I get in and update the source sheets, I want to copy the data automatically into D9 and the same process goes on each day, D10, D11 and so on. "Nigel" wrote: If I understand you correctly.. You have a value on Sheet3 Range C3 and Range C4 (the source) which you wish to add to the values already in Sheet1 Column D or Column E (the target). How do you wish to specify the target range? The whole of column D and E or something else? Should be straightforward given the conditions. Post your specifc needs -- Regards, Nigel "drinese18" wrote in message ... Basically the procedure involves me copying a value from Cell C3 from Sheet3 into a Range of cells on Sheet1, the reason why I don't specify the cells on Sheet1 is because I am not only copying into one cell on Sheet1. Sheet3 is basically updated everyday, so I basically want to copy the values from the cell in Sheet3 into Sheet1 but not overwriting the data that is already just basically adding to the data that is already there, the column that I'm copying the data into is Column D on Sheet1. I basically want to do the samething for Sheet3 Cell C4, basically copying data from that cell into column E on Sheet1, and also doing the samething for Sheet4, copying Cell C3 from Sheet4 into column H on Sheet1. There is already data on Sheet1 so I would just like to add to what is already there without overwriting anything. I recorded a macro, which you can see below: Sub Macro2() Sheets("Sheet3").Select Range("C3").Select Selection.Copy Sheets("Sheet1").Select Range("D8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet3").Select Range("C4").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("E8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Sheet4").Select Range("C3").Select Application.CutCopyMode = False Selection.Copy Sheets("Sheet1").Select Range("H8").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False ActiveWorkbook.Save End Sub Basically the macro only works for one cell, but it overwrites the data that is already within the cells on sheet1, I just want it to add to that data that is already there, so if you can help me with this it would be greatly appreciated, thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copying selected contents in one cell to another cell | Excel Worksheet Functions | |||
Copying cell contents from many cells and pasting into one cell | Excel Discussion (Misc queries) | |||
Copying formulas from cell to cell to cell to....... | Excel Discussion (Misc queries) | |||
Copying format to a new cell, w/o overwriting destination cell contents | Excel Discussion (Misc queries) | |||
copying the function contained within a cell to anouther cell. | Excel Worksheet Functions |