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.
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.
Sub Macro1() ' Copy and Paste row 'Range("A1:CW1").Copy Range("A10").Paste End Sub
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
For something like this you may not even need copy/ paste
Sub MoveVal() Range("A10").Value = Range("A1").Value End Sub
"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
Option Explicit Sub Something() Range(Range("A1"), Range("A1").End(xlToRight)).Copy Cells(ActiveCell.Row, 1) End Sub
Last edited by Paul_Hossler; 01-27-2022 at 06:36 AM.
---------------------------------------------------------------------------------------------------------------------
Paul
Remember: Tell us WHAT you want to do, not HOW you think you want to do it
1. Use [CODE] ....[/CODE ] Tags for readability
[CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
2. Upload an example
Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
3. Mark the thread as [Solved] when you have an answer
Thread Tools (on the top right corner, above the first message)
4. Read the Forum FAQ, especially the part about cross-posting in other forums
http://www.vbaexpress.com/forum/faq...._new_faq_item3
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:
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 workbookOption Explicit Sub Something1() Cells(1, ActiveCell.Column).Copy ActiveCell End Sub
---------------------------------------------------------------------------------------------------------------------
Paul
Remember: Tell us WHAT you want to do, not HOW you think you want to do it
1. Use [CODE] ....[/CODE ] Tags for readability
[CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
2. Upload an example
Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
3. Mark the thread as [Solved] when you have an answer
Thread Tools (on the top right corner, above the first message)
4. Read the Forum FAQ, especially the part about cross-posting in other forums
http://www.vbaexpress.com/forum/faq...._new_faq_item3
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
---------------------------------------------------------------------------------------------------------------------
Paul
Remember: Tell us WHAT you want to do, not HOW you think you want to do it
1. Use [CODE] ....[/CODE ] Tags for readability
[CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
2. Upload an example
Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
3. Mark the thread as [Solved] when you have an answer
Thread Tools (on the top right corner, above the first message)
4. Read the Forum FAQ, especially the part about cross-posting in other forums
http://www.vbaexpress.com/forum/faq...._new_faq_item3