I am a newbie in VBA Excel.
Let's say, I have to take the value of cell A1 and paste it to the active cell in the SAME column.
So, copy cell A1 with value 123 to the active cell A10.
Sounds easy? Please help.
Printable View
I am a newbie in VBA Excel.
Let's say, I have to take the value of cell A1 and paste it to the active cell in the SAME column.
So, copy cell A1 with value 123 to the active cell A10.
Sounds easy? Please help.
without VBA, you can just copy/paste the value from A1 to A10.
or add a formula in A10:
=A1
with VBA, just Record a Macro.
I maybe did not explain the task very well. I am looking for copy/paste automation. I need to paste the value from the top row cell to the same column cell below by activating this cell and hitting the shortcut key. In my mind, it should be a macro with custom VBA code inside.
Thank you in advance.
that's what i said,
Record a macro.
copy and paste the cells.
Save the macro.
if you go to VBA you will see that it created a Public sub with VBA code in it.
you only need to Edit the macro to Always copy from the Top cell.
"Edit the macro to Always copy from the Top cell" - it's my problem. I need to have the same logic for all 100 other columns.
Code:Sub Macro1()
' Copy and Paste row
'Range("A1:CW1").Copy
Range("A10").Paste
End Sub
For something like this you may not even need copy/ paste
Code:Sub MoveVal()
Range("A10").Value = Range("A1").Value
End Sub
Quote:
"Edit the macro to Always copy from the Top cell" - it's my problem. I need to have the same logic for all 100 other columns.
That's why it's important to provide all information and maybe even a sample workbook
Code:Option Explicit
Sub Something()
Range(Range("A1"), Range("A1").End(xlToRight)).Copy Cells(ActiveCell.Row, 1)
End Sub
Hi Paul,
It's worked! The thing is it's copying the entire top row to the active row/cells. I just looking for a copy one cell at a time from the top row cell.
Thank you!
Guess I misunderstood:
Quote:
I need to have the same logic for all 100 other columns.
If that is still not it, then you'll have to come up a very detailed example workbookCode:Option Explicit
Sub Something1()
Cells(1, ActiveCell.Column).Copy ActiveCell
End Sub
You got it! Very elegant!
THANK YOU VERY MUCH! I REALLY APPRECIATE IT!
Glad it works
You can mark it [SOLVED] using #3 in my signature