Kindly requesting help with my VBA code. I have a mastersheet that contains a table summarizing several projects where each row contains information about one project. I then have tabs for each project and the code is to pull information from the master sheet into the corresponding tab. To do this, I have listed the project names on the first row of the table in the master tracker and used the same name for the tab. As the code moves from sheet to sheet, the code reads the sheet name and then uses the vlookup to pull the information from the master tracker into the corresponding sheet.
I am getting an error stating on my 'next' command stating I have a 'next with for'. Please help. I have intermittent experience with VBA - not frequent enough to be proficient.
Sub Macro1()
'Run the API for every sheet in the workbook
Dim Sht As Worksheet
For Each Sht In ThisWorkbook.Worksheets
'Look to see what the sheet is named and run the macro if it is not what is below
If Sht.Name <> "Modified" And Sht.Name <> "Original" And Sht.Name <> "Master Tracker" Then
Sht.Activate
'Looks for the tab name in the master sheet and copies the information from the corresponding row into the project tab
Range("C2:N2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(MID(CELL(""filename"",R[-2]C[-15]),FIND(""]"",CELL(""filename"",R[-2]C[-15]))+1,255),'Master Tracker'!R2C1:R35C14,2,FALSE)"
Range("C3:N3").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(MID(CELL(""filename"",R[-2]C[-15]),FIND(""]"",CELL(""filename"",R[-2]C[-15]))+1,255),'Master Tracker'!R2C1:R35C14,3,FALSE)"
Range("A9:D24").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(MID(CELL(""filename"",R[-2]C[-15]),FIND(""]"",CELL(""filename"",R[-2]C[-15]))+1,255),'Master Tracker'!R2C1:R35C14,4,FALSE)"
Range("F9:J24").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(MID(CELL(""filename"",R[-2]C[-15]),FIND(""]"",CELL(""filename"",R[-2]C[-15]))+1,255),'Master Tracker'!R2C1:R35C14,5,FALSE)"
Range("L9:N15").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(MID(CELL(""filename"",R[-2]C[-15]),FIND(""]"",CELL(""filename"",R[-2]C[-15]))+1,255),'Master Tracker'!R2C1:R35C14,6,FALSE)"
Range("L17:N24").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(MID(CELL(""filename"",R[-2]C[-15]),FIND(""]"",CELL(""filename"",R[-2]C[-15]))+1,255),'Master Tracker'!R2C1:R35C14,7,FALSE)"
Range("B4").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(MID(CELL(""filename"",R[-2]C[-15]),FIND(""]"",CELL(""filename"",R[-2]C[-15]))+1,255),'Master Tracker'!R2C1:R35C14,8,FALSE)"
Range("B5").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(MID(CELL(""filename"",R[-2]C[-15]),FIND(""]"",CELL(""filename"",R[-2]C[-15]))+1,255),'Master Tracker'!R2C1:R35C14,9,FALSE)"
Range("F4:I6").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(MID(CELL(""filename"",R[-2]C[-15]),FIND(""]"",CELL(""filename"",R[-2]C[-15]))+1,255),'Master Tracker'!R2C1:R35C14,10,FALSE)"
Range("K4").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(MID(CELL(""filename"",R[-2]C[-15]),FIND(""]"",CELL(""filename"",R[-2]C[-15]))+1,255),'Master Tracker'!R2C1:R35C14,11,FALSE)"
Range("K6").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(MID(CELL(""filename"",R[-2]C[-15]),FIND(""]"",CELL(""filename"",R[-2]C[-15]))+1,255),'Master Tracker'!R2C1:R35C14,12,FALSE)"
Range("N4").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(MID(CELL(""filename"",R[-2]C[-15]),FIND(""]"",CELL(""filename"",R[-2]C[-15]))+1,255),'Master Tracker'!R2C1:R35C14,13,FALSE)"
Range("N6").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(MID(CELL(""filename"",R[-2]C[-15]),FIND(""]"",CELL(""filename"",R[-2]C[-15]))+1,255),'Master Tracker'!R2C1:R35C14,14,FALSE)"
Next
'activate the worksheet that was originally active
starting_ws.Activate
End Sub
'At the end of the program say it has all been updated
MsgBox ("Update Complete