with filter 4 different columns value copy and paste in to one columns (one by one) in another excel sheet

pramod5542

New Member
Joined
Feb 12, 2016
Messages
4
I write a code its working as per column range.......
code is given below.... but i want to below image mention

VBA Code:
Sub Fill_Invoice_Details()
    Dim sh As Worksheet
    Dim dsh As Worksheet
    
    Set sh = ThisWorkbook.Sheets("Invoice")
    Set dsh = ThisWorkbook.Sheets("Sales")
    
    sh.Range("B16:I33").ClearContents
    sh.Range("J5").ClearContents
    sh.Range("J10").ClearContents
    sh.Range("B6:B11").ClearContents
    sh.Range("J37").ClearContents
    
    Dim lr As Long
    lr = Application.WorksheetFunction.CountA(dsh.Range("A:A"))
    
    dsh.UsedRange.AutoFilter 1, Me.TextBox1.Value
    
    dsh.Range("L2:M" & lr + 1).SpecialCells(xlCellTypeVisible).Copy
    sh.Range("B16").PasteSpecial
    
    sh.Range("B16").WrapText = True
  
    dsh.Range("M2:M" & lr + 1).SpecialCells(xlCellTypeVisible).Copy
    sh.Range("C16").PasteSpecial xlPasteValues
    
    
    dsh.Range("K2:K" & lr + 1).SpecialCells(xlCellTypeVisible).Copy
    sh.Range("E16").PasteSpecial xlPasteValues
    
    sh.Range("F15").PasteSpecial xlPasteValues
    dsh.Range("P2:P" & lr + 1).SpecialCells(xlCellTypeVisible).Copy
    sh.Range("G15").PasteSpecial xlPasteValues
    dsh.Range("Q2:Q" & lr + 1).SpecialCells(xlCellTypeVisible).Copy
    sh.Range("H15").PasteSpecial xlPasteValues
    
    
    
    dsh.Range("N2:Q" & lr + 1).SpecialCells(xlCellTypeVisible).Copy
    sh.Range("F16").PasteSpecial xlPasteValues
    
    dsh.AutoFilterMode = False
  
    
    dsh.AutoFilterMode = False
     
    sh.Range("J5").Value = Me.TextBox1.Value
    sh.Range("J7").Value = Me.TextBox2.Value
    sh.Range("J10").Value = Me.TextBox10.Value
    sh.Range("B6").Value = Me.ComboBox4.Value
    sh.Range("B7").Value = Me.TextBox11.Value
    sh.Range("B8").Value = Me.TextBox12.Value
    sh.Range("B9").Value = Me.TextBox13.Value
    sh.Range("B10").Value = Me.TextBox14.Value
    sh.Range("B11").Value = Me.TextBox15.Value
    sh.Range("J37").Value = Me.TextBox9.Value
    

End Sub
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
My query is below mention image
 

Attachments

  • sales.png
    sales.png
    211.3 KB · Views: 6
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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