EliseFreedman
Programmer
Hi There
I have got a list of managers in my spreadsheet. I am trying to cycle through the range and load each manager into a specific cell which I am then using as the basis to run a series of macros (filtering the data in two sheets, copying the data into another workbook, creating pivot tables based on the copied data then finally saving the workbook) before moving onto the next name in the list and repeating the process. The code works for the first name in the list but then never moves to the next name in the list. Not sure what I am doing wrong. Can anyone help as it has been driving me nuts all afternoon.
I am using the code below
I have got a list of managers in my spreadsheet. I am trying to cycle through the range and load each manager into a specific cell which I am then using as the basis to run a series of macros (filtering the data in two sheets, copying the data into another workbook, creating pivot tables based on the copied data then finally saving the workbook) before moving onto the next name in the list and repeating the process. The code works for the first name in the list but then never moves to the next name in the list. Not sure what I am doing wrong. Can anyone help as it has been driving me nuts all afternoon.
I am using the code below
Code:
Dim rng As Range
Set rng = Application.Range("Search!T1:T38")
Dim i As Integer
For i = 1 To rng.Rows.Count
Range("C5").Value = rng.Cells.Value ' C5 has the name of the manager i am filtering by
Call FilterRangeCriteria
Call CopyFilteredData
Call CopyFilteredData2
Next i