VBA Macro for Auto Printing from a List box

Jyotirmaya

Board Regular
Joined
Dec 2, 2015
Messages
168
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 ??
 

Forum statistics

Threads
1,082,273
Messages
5,364,168
Members
400,785
Latest member
Mahar92

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top