VBA - Copy cell from Sheet 2, paste into Sheet 1, print and return to next value in Sheet 2

harlequeens

New Member
Joined
Apr 17, 2015
Messages
1
Hi

I am sure for anyone with a modicum of VBA skills, this will be a sinch, but for someone like me who last tried macros using Lotus 1-2-3, I'm struggling.

I would like to copy the values contained in 3 particular cells, A9, B9 and P9 from Sheet 2 of a spreadsheet to cells B2, B3 and D2 respectfully on Sheet 1 of the same spreadsheet, (which is formatted to a particular shape and size of label, with multiple labels on the same sheet, when it prints), where column A is a first name, column B is a last name, and column P is a location.

Then I want to copy the next person's values contained in the next row of sheet 2, i.e. cells A10, B10 and P10 from Sheet 2 of the spreadsheet to cells B2, B3 and D2 respectfully on Sheet 1 again thereby overwriting the data that has already been printed. I then want to print the sheet again with the new values. This process would be repeated until the first blank cell in column A of sheet 2 is reached.

Any help would be gratefully appreciated.

Thanks

Mike
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
See if you can use this.
Code:
Sub labels()
Dim sh1 As Worksheet, sh2 As Worksheet, lr As Long
Set sh1 = Sheets(1) 'Edit sheet name
Set sh2 = Sheets(2) 'Edit sheet name
lr = sh2.Cells(Rows.Count, 1).End(xlUp).Row
    For i = 9 To lr
        sh1.Range("B2") = sh2.Cells(i, 1)
        sh1.Range("B3") = sh2.Cells(i, 2)
        sh1.Range("D2") = sh2.Cells(i, 16)
        sh1.PrintOut
        s = Timer + 2
            Do While Timer < s
                DoEvents
            Loop
    Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,270
Members
452,628
Latest member
dd2

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