PDA

View Full Version : Solved: copy cell data



inajica
12-20-2010, 10:05 PM
In Workbook1 I have two columns--A and B. In A I have cell references, and in column B I have numbers, and want to copy the numbers and paste them based on what the cell reference is into sheet2. I uploaded the file Workbook1. Thankyou for any help.

shrivallabha
12-20-2010, 11:32 PM
Here is a code that will do as you need. Place this in Sheet1 module.

Sub PasteData()
With Sheet1
For i = 1 To .Range("A" & Rows.Count).End(xlUp).Row
Sheet3.Range(.Range("A" & i).Value) = .Range("B" & i).Value
Next i
End With
End Sub

Please note for now, I've made it Sheet3 instead of Sheet2 for comparison.

inajica
12-21-2010, 09:16 AM
Thank you for the reply. The code was what I was looking for.