I have a sheet called Job List which has a list of all the jobs available. Then I have a page called "Team_Jane" which contains 3 tables that should hold Jane's Current Jobs, Pending Jobs and Completed Jobs.
I have written a bit of VBA that does an advanced filter on the Job List and puts the filtered information in and that works fine, BUT because the Current Jobs list is above the Pending Jobs list, I need to be able to insert a number of rows equal to the number of rows the advanced filter needs to add before applying the filter, or I accidentally override the pending jobs if someone has a lot of current jobs they are doing.
Does anyone know how to do this?
The code I have looks like this, and I can add a row to the CompletedJobs table, but I need to do this before the advancedfilter is applied in order to ensure there is enough space to add the extra items to the table.
I just need to replace the NumJobs integer with something that is calculated before the filter is applied.
I have written a bit of VBA that does an advanced filter on the Job List and puts the filtered information in and that works fine, BUT because the Current Jobs list is above the Pending Jobs list, I need to be able to insert a number of rows equal to the number of rows the advanced filter needs to add before applying the filter, or I accidentally override the pending jobs if someone has a lot of current jobs they are doing.
Does anyone know how to do this?
The code I have looks like this, and I can add a row to the CompletedJobs table, but I need to do this before the advancedfilter is applied in order to ensure there is enough space to add the extra items to the table.
I just need to replace the NumJobs integer with something that is calculated before the filter is applied.
Code:
Private Sub Worksheet_Activate()
Sheets("Job List").Range("B3:H1048575").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Calculations").Range("B3:H5"), CopyToRange:=Sheets("Team_Jane").Range( _
"B21:H21"), Unique:=False
Dim numbJobs As Integer
numJobs = 1
Set tbl = Sheets("Team_Jane").ListObjects("Jane_completedJobs")
Set Rng = Range("Jane_completedJobs[#All]").Resize(tbl.Range.Rows.Count + numJobs, tbl.Range.Columns.Count)
tbl.Resize Rng
End Sub