VBA Macro for Auto Printing from a List box

Jyotirmaya

Board Regular
Joined
Dec 2, 2015
Messages
204
Office Version
  1. 2019
Platform
  1. Windows
I have 2 sheets "Printout" & "Notice". I want the Printout sheet to Print Automatically after selecting the Value from K1 cell. K1 cell is the dependent list based on Data validation. I want to Print from A1 to I59 Range of Printout sheet. When I select a list in the K1 cell various cell of the Printout sheet changes as I am using Vlookup function in the sheet. the linked data is there in the notice sheet from where the data is linking. I want that when I will select a new value then it will print the Range. As I am using VlookUp & the range of the notice sheet is upto 12000 rows it takes 3 to 4 seconds to populate the values from notice sheet to Printout sheet.


I dont know VB much, a similar code I have found which relates to my question.

Sub PrintfromDVList()
Dim ws As Worksheet
Dim i As Long

Set ws = Sheets("Sheet2")

For i = 1 To ws.Cells(Rows.Count, "A").End(xlUp).Row
With Sheets("Sheet1")
.Range("D6").Value = ws.Cells(i, "A").Value
.PrintPreview ' Change to PrintOut after testing
End With
Next i

End Sub


Where Sheet2 is the Data Validation source sheet and the list is in Column A with no headers, and Sheet1 is the sheet to print.

What should be the change in the above code ??
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,212,927
Messages
6,110,733
Members
448,294
Latest member
jmjmjmjmjmjm

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