Help Condition Value Format with output

kingg9999

New Member
Joined
Jul 12, 2015
Messages
40
Dear Masters,

I Work in a uniform Tailor shop but i dont have much idea for excel.

can some one help me making one thing

Below it the kind of data we have same format 400 rows above and i have to do manual thing to pint the below image in (b)


Image Sample of data (a)

1609931204413.png


below the out put i required so i can print in one short (b)


1609931381758.png
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi Kingg
Just a couple of quesion before we start
Are the files numbers unique?
Will you put in the file number to get the data?

Thanks
Excel Fun
 
Upvote 0
Hi EFan,

File number are unique a customer name as well.

First we will fill all the data in the sheet.

Name-----File Number------Size of T Shirt-----Size of Trouser-----QTY of T Shirt -------QTY of Trouser

Then we print them


Regards,

Kingg
 
Upvote 0
Hi Kingg

I have spent about an hour recreating the code below

What it does:
Goes through each record you have in data sheet
Will process any that havent been printed yet(to reprint remove green color
Fills the report and prints
Moves to the next one
Will stop when no file number in next row

Things to know:
Change the sheet names in the code, this is the vba name not the name ou gave the sheet on the tab
This will find where your data table is in the data sheet so no need to set a range

Any issues let me know
Code:
Sub PrintReports()
    
    'Get all references for all needed ranges
    
    Dim FirstRow As Integer
    Dim FileNo As Integer
    Dim Shirt As Integer
    Dim Trouser As Integer
    Dim ReportRng As Range
    Dim Entry As Range
    Dim Records As Worksheet
    Dim ShirtCell As Range
    Dim TrouserCell As Range
    
    Set Records = Sheet1  ':::::Change to the name of your data sheet
    Set ReportRng = Sheet2.Range("A1")   ':::::Change to the name of your report sheet and cell you want it to be in     
 
    FileNo = Records.Cells.Find("File no.").Column
    FirstRow = Records.Cells.Find("File no.").Row + 1
    
    Shirt = Records.Cells.Find("Shirt").Column
    Trouser = Records.Cells.Find("Trouser").Column
    
    'Set up report template
    ReportRng = "Name"
    ReportRng.Offset(1) = "File No"
    ReportRng.Offset(2) = "T Shirt"
    ReportRng.Offset(3) = "Trouser"
    Sheet2.Range(ReportRng.Offset(, 1).Address, ReportRng.Offset(, 2).Address).Merge
    Sheet2.Range(ReportRng.Offset(1, 1).Address, ReportRng.Offset(1, 2).Address).Merge
    
    'Iterate through records and print
    With Records
        For Each Entry In .Range(.Cells(FirstRow, FileNo), .Cells(.Cells(FirstRow, FileNo).End(xlDown).Row, FileNo))
            If Entry.Interior.ColorIndex <> 4 Then
                'Get Shirt
                Set ShirtCell = .Range(.Cells(Entry.Row, Shirt), .Cells(Entry.Row, Trouser - 1)).Find("1")
                If Not ShirtCell Is Nothing Then
                    ReportRng.Offset(2, 1) = .Cells(FirstRow - 1, ShirtCell.Column)
                    ReportRng.Offset(2, 2) = ShirtCell
                End If
                'Get Trouser
                Set TrouserCell = .Range(.Cells(Entry.Row, Trouser), .Cells(Entry.Row, Trouser).End(xlToRight)).Find("1")
                If Not ShirtCell Is Nothing Then
                    ReportRng.Offset(3, 1) = .Cells(FirstRow - 1, TrouserCell.Column)
                    ReportRng.Offset(3, 2) = TrouserCell
                End If
                'Get Name & File number
                ReportRng.Offset(, 1) = Entry.Offset(, -1)
                ReportRng.Offset(1, 1) = Entry
                'Print report
                Range(ReportRng, ReportRng.Offset(3, 2)).PrintOut
                'Set cell to printed
                Entry.Interior.ColorIndex = 4
                
            End If
        Next Entry
    End With
End Sub
 
Upvote 0
Dear Efan,

Not working for me

I added in micro but when tried to run gives me error can you give me video reference or guide.


Plus how to repay you bro Thanks You
 
Upvote 0
Please upload Example file & desired Result with XL2BB ADDIN (Preferable) or upload your file at free hosting site e.g. www.dropbox.com, GoogleDrive or Onedrive & input link here.
I think you can change Shirt columns to 2 columns 1. Shirt Size 2. Shirt No.
Also for Trouser : 1. Trouser Size 2. Trouser No.
But upload your file with old format to work on it.
 
Upvote 0
Try this file. I use your AM to AO column to create searchable dropdown List. if have problem hide them, or change color to white.
Select first from dropdown List (searchable) then Click on Employee Report to Updated.

Report

And I forgot to disable dropdown list for printing, for that go to developer tab, Enable design mode, Rightclick on dropdown combobox, Select Properties
And Change PrintObject to false, Close it and disable Design mode
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,108
Messages
6,123,128
Members
449,097
Latest member
mlckr

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