Morning all,
I've created VBA code to automate a very manual process of parsing data from one worksheet into several other work sheets for onward saving as individual .CSV files. The macro works great and I've even sorted a macro to save each individual worksheet as a .CSV into a folder so productivity wise it's looking very good!
My question comes around selecting the contents of the active table of data subject to an autofilter. For example, I have a large amount of data in this worksheet spanning to row 851079, I apply some filters which shows rows up to 29369. This part of the code shows it uses absolute references:
ActiveSheet.Range("$A$1:$Q$851079").AutoFilter Field:=5, Criteria1:="EE"
ActiveSheet.Range("$A$1:$Q$851079").AutoFilter Field:=6, Criteria1:="2G"
Range("A1:Q851079").Select
Range("F29342").Activate
Selection.Copy
Sheets.Add After:=ActiveSheet
ActiveSheet.Paste
This works for this workbook, but not every workbook I need the macro to run in will have exactly 851079 rows, it will have more/less but likely never the same.
My initial thoughts are rather 'agricultural' in that changing the range to the very last row in the worksheet (1048576). The number of columns will always be the same.
But is there a smarter way?