Hello All,
I'm looking for a way to create a macro I can run across various workbooks that are used for inventory tracking and management. Each workbook has numerous tabs with various names that are based on dates of inventory purchase. First, I'm not sure if there is a way to make the code read "do this for all sheets in this workbook, regardless of the tab name". Usually codes reference a specific sheet, but my programming skills are at a very beginner level and there may be a way to do it. Possibly this, which I found on a Microsoft website,
Sub WorksheetLoop()
Dim WS_Count As Integer
Dim I As Integer
' Set WS_Count equal to the number of worksheets in the active
' workbook.
WS_Count = ActiveWorkbook.Worksheets.Count
' Begin the loop.
For I = 1 To WS_Count
But I'm not sure if that will achieve what I am looking for.
So basically all I want it to do it to look in a column for a specific value, in my case I'm looking for the year the inventory has sold. If any cell in the column is the current year, I want it to paste the entire row into a new sheet. Currently when I need to create a YTD sales spreadsheet I just go through each tab of each workbook by hand, filter the year sold column to the current year, and copy/paste the values over to the new sheet.
So in plain English:
For all sheets in this workbook, if the value in any cell in the year sold column equals 2019, then copy and paste the entire row into a new sheet, and at the end of all of the pasting of these value, sum each column of sales price, cost, net profit.
Any ideas on how I can create a macro to handle this for me?
Thanks in advance
Bookmarks