Requirement:
The user has an excel sheet with sheets "Checklist" & "CAR", in which the user needs a VBA code in the checklist sheer in "Generate CAR" button and if click that button CAR report to be generated in "CAR" sheet as provided in the attached excel sheet.
Solution:
Try the following code assigned to your button:-
Sub Test() Dim ws As Worksheet: Set ws = Sheets("Checklist") Dim ws1 As Worksheet: Set ws1 = Sheets("CAR") Application.ScreenUpdating = False ws1.UsedRange.Offset(4).ClearContents ws.Range("I5", ws.Range("I" & ws.Rows.Count).End(xlUp)).AutoFilter 1, "CAR" ws.Range("C6", ws.Range("H" & ws.Rows.Count).End(xlUp)).Copy ws1.Range("C" & Rows.Count).End(3)(2).PasteSpecial xlValues ws.[I5].AutoFilter Application.CutCopyMode = False Application.ScreenUpdating = True End Sub
Obtained from the OzGrid Help Forum.
Solution provided by vcoolio.
See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets
See also:
How to use Excel VBA code to hide based on criteria |
How to protect VBA source code from view |
How to use VBA to turn columns into rows |
How to create VBA for index and match based on sheet criteria |
How to use VBA Code in Excel to display a balloon |
Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.