VBA Newbie Needs help.

wrightyrx7

Well-known Member
Joined
Sep 15, 2011
Messages
994
Hi all,

I recorded a macro and wanted some help, as recording it will never show the VBA i need :(

Sub Test()

Range("A4").Select
Selection.Copy
Sheets("Advance Payment").Select
Range("B6").Select
ActiveSheet.Paste
End Sub

As you can see this selects cell A4 to copy.
When i run this macro I want this to select and copy the data that is in column A of the activerow.

Can any help?

Thanks
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Thank you very much for the reply.

As im only just learning VBA can i ask what the Cells(6,2) does?

Thanks
 
Upvote 0
Oh right just tested it an it pastes it to the same worksheet. I wanted it to paste to another worksheet Name="Advance Payment" (sheet5)

how would i do that?

Thanks again
Chris
 
Upvote 0
Oh right just tested it an it pastes it to the same worksheet. I wanted it to paste to another worksheet Name="Advance Payment" (sheet5)

how would i do that?

Thanks again
Chris
Code:
Sub Test()
Cells(ActiveCell.Row, 1).Copy [COLOR=Red]Sheets("Advance Payment").[/COLOR]Cells(6, 2)
End Sub
 
Upvote 0
Thanks you have been a great help, can i push my luck and ask.

If i wanted to copy lets say column A and B from the active row and paste them in the same cell on the other sheet with a space. Can this be done?

This is for the first name and second name you see.

Thanks
Chris
 
Upvote 0
Thanks you have been a great help, can i push my luck and ask.

If i wanted to copy lets say column A and B from the active row and paste them in the same cell on the other sheet with a space. Can this be done?

This is for the first name and second name you see.

Thanks
Chris

No problem, thanks for the feedback. Try this:
Code:
Sub Test()

Sheets("Advance Payment").Cells(ActiveCell.Row, ActiveCell.Column) = Cells(ActiveCell.Row, 1) & " " & Cells(ActiveCell.Row, 2)

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,486
Members
452,917
Latest member
MrsMSalt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top