• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Pasting Data to different cells

Injinia

Member
Hi,


I have a list of 10 items in sheet 1; A1:A10. in the same sheet B1:B10, I have cell cell locations where the items should be pasted into.


In B1 for example, I have about 150 different cell locations between in columns R, S and T. This is the case with each of the other 9 items in column A.


The cell locations are listed as follows; (R3; R17; R28.....)


Instead of doing this manually, is there a way of copying the items in A1:A10 and paste them in the relevant cell locations listed in B1:B10.


Thanks in advance for your help.


Regards,

Injinia
 
How's this? Note that I'm assuming the text in col B are literally "R3; R17; R28". If there are parenthesis, those will need to be removed.

[pre]
Code:
Sub PasteMultiple()
Dim myRanges As Variant

Dim c As Range

Application.ScreenUpdating = False
'Where are we looking?
For Each c In Range("A1:A10")

'Where are the cells with range addresses?
myRanges = Split(c.Offset(0, 1).Value, ";")

'Copy the data
For i = 0 To UBound(myRanges)
c.Copy Range(myRanges(i))
Next i
Next c

Application.ScreenUpdating = True
End Sub
[/pre]
 
Back
Top