GTretick
Member
Hello,
I am trying to use a Match function in VBA to look up a cell position on another sheet.
I get a type mismatch error when doing so. I've tried changing various variables and cell formats but to no avail.
I can't tell exactly what variable or cell is offending the code.
I've attached a sanitized version of my workbook for reference.
Items highlighted in pink rely on other subroutines and formulas I've deleted from this version. They are there in case somehow their presence impacts my problem.
For context what I am ultimately trying to do is look in the grid in cells O3 to X12 in the "Background" tab then place the value (that corresponds between the dates in rows 3 and 4 in the "Monthly Outlook" tab) into each cell from N112 to Y112.
I'm building the routine is small steps.
1 Find the month my column represents > Mth = Month(Cells(4, mc))
2 Find the year my column represents > Yr = Year(Cells(4, mc))
3 Find what column in Background my year is located in > YrCol = Application.Match(Yr, Worksheets(Sheet3).Range(Cells(2, 15), Cells(2, 24)), 0)
**** this is my line I am having problems with *****
4 Find what row in Background my month is located in > not developed yet
5 Cross reference the row and column to grab the correct data > not developed yet
The macro is enabled by pressing the star in cell N1
Thanks for any consideration you might give to my issue.
I am trying to use a Match function in VBA to look up a cell position on another sheet.
I get a type mismatch error when doing so. I've tried changing various variables and cell formats but to no avail.
I can't tell exactly what variable or cell is offending the code.
I've attached a sanitized version of my workbook for reference.
Items highlighted in pink rely on other subroutines and formulas I've deleted from this version. They are there in case somehow their presence impacts my problem.
For context what I am ultimately trying to do is look in the grid in cells O3 to X12 in the "Background" tab then place the value (that corresponds between the dates in rows 3 and 4 in the "Monthly Outlook" tab) into each cell from N112 to Y112.
I'm building the routine is small steps.
1 Find the month my column represents > Mth = Month(Cells(4, mc))
2 Find the year my column represents > Yr = Year(Cells(4, mc))
3 Find what column in Background my year is located in > YrCol = Application.Match(Yr, Worksheets(Sheet3).Range(Cells(2, 15), Cells(2, 24)), 0)
**** this is my line I am having problems with *****
4 Find what row in Background my month is located in > not developed yet
5 Cross reference the row and column to grab the correct data > not developed yet
The macro is enabled by pressing the star in cell N1
Thanks for any consideration you might give to my issue.