VBA Data Entry

Johndinho

Board Regular
Joined
Mar 21, 2013
Messages
90
Hi,

I'm trying to code some data migration between 2 spreadsheets.
My stumbling block is knowing how to tell the code where to paste the data.

The destination workbook has a list of unique IDs in columnQ but the data needs to be pasted into the relevant ColumnD.

I can get the cell reference I need into a separate cell - A1 for instance so my copied data I then need to paste to the cell reference shown in A1 - Q50 for instance

Any ideas how I do this?

Thanks
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Hi Johndinho,

I don't know VBA, but why not record a macro of you doing what you need to do manually, and then jump into the code to see if you can take anything from it.
I just tried an example and it works for the macro side of things.
Just a thought.

Code:
Sub Macro1()'
' Macro1 Macro
'


'
    Range("A1:Q10").Select
    Selection.Copy
    Sheets("Sheet2").Select
    Range("D1").Select
    ActiveSheet.Paste
End Sub

Best regards
manc
 
Last edited:
Upvote 0
Thanks Manc but I want to use the value of A1 to tell the VBA where to paste

My code would look like

Code:
Range("A1").Value = 10
Range("B1").copy
Range("Q" & cells(1, 1)).Paste Special xlValues

My aim is to paste the value of B1 into Q10 based on A1 containing 10
 
Upvote 0
No need for Copy/Paste.
You can just do it like this:
Code:
Range("A1").Value = 10
Range("Q" & Cells(1, 1).Value) = Range("B1")
 
Upvote 0
Solution

Forum statistics

Threads
1,223,909
Messages
6,175,312
Members
452,634
Latest member
cpostell

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