Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automate Copy and Paste funtion from a cell value Excel

Status
Not open for further replies.

Chuck712

Technical User
Mar 1, 2002
133
US
I have a project involving a contest where people are given 1 credit for each 2 persons that they sign up as members. I am able to bring the counts of those total into Excel and get a value of how many times a person should be entered into the drawing for the grand prize. What I would like to do is to copy and paste that persons name and address back into the spreadsheet based on the value in the cell. For example
Joe Smith 123 Main St. 3

Would come back
Joe Smith 123 Main St.
Joe Smith 123 Main St.
Joe Smith 123 Main St.

I am not sure if this can be done, but I thought I would throw it out there.
Chuck
 
Adapt this code as you need:
Code:
Dim CountValue As Integer
Dim i As Integer
CountValue = Range("B2").Value
Range("B1").Select
Selection.Copy 'copy the name
For i = 1 To CountValue
  'to paste into cells B4:B6 assuming CountValue is 3
  Cells(i + 3, 2).Activate
  ActiveSheet.Paste
Next i
Clive [infinity]
 
Sorry...forgot to mention...this example assumes name & address is in B1 and the count value is in B2. The name & address is then copied to cells B4:B6 (assuming that the count value is 3). Hope this helps Clive [infinity]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top