Print button to print specific cell in a row

Nour

New Member
Joined
Jun 16, 2021
Messages
34
Office Version
  1. 2016
Platform
  1. Windows
Hello. I need assistance. I created a print button to print content of a specific cell in a row using VBA print command. But I want to replicate that button to print content of corresponding cell in each row...say I place print button on column K to always print content of adjacent column J on each row ie. print button on K1 prints J1, K2 prints J2, K3 print J3 etc. At the moment, if I copy the button on all column K, it will always print content of specific cell entered in the VBA eg J1. How do I replicate it for all the rows? Like in this image I posted, I want to print the receipt number entered in each cell of column I by clicking the print button in column I. Pls assist. Thanks.
 

Attachments

  • 20210616-163252.png
    20210616-163252.png
    39.1 KB · Views: 61

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Try assigning the following macro to your print button:
VBA Code:
Sub PrintCell()
    ActiveSheet.Buttons(Application.Caller).TopLeftCell.Offset(, -1).PrintOut
End Sub
 
Upvote 0
Try assigning the following macro to your print button:
VBA Code:
Sub PrintCell()
    ActiveSheet.Buttons(Application.Caller).TopLeftCell.Offset(, -1).PrintOut
End Sub
Also pls is there a way I can make the button to only appear when there is data in a particular cell on the row so that I do not need to copy all the buttons throughout the length of the worksheet as it will make it buggy and probably slow it down. Another scenario is for a print button to be in another cell but displayed in the
Try assigning the following macro to your print button:
VBA Code:
Sub PrintCell()
    ActiveSheet.Buttons(Application.Caller).TopLeftCell.Offset(, -1).PrintOut
End Sub
Try assigning the following macro to your print button:
VBA Code:
Sub PrintCell()
    ActiveSheet.Buttons(Application.Caller).TopLeftCell.Offset(, -1).PrintOut
End Sub
Also pls is there a way I can make the button to only appear when there is data in a particular cell on the row so that I do not need to copy all the buttons throughout the length of the worksheet as it will make it buggy and probably slow it down. Another scenario is for a print button to be in another cell like L4 but displayed in the needed cell in column K when data is entered in corresponding cell in another column like say A say...ie when A2 is not blank, print button displays on K4 to print content of J4. If A2 is blank, no button for print available. Thanks.
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

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