I have a workbook with 2 worksheets. Worksheet 1 has data entry table while worksheet 2 has 2 columns for a list of names and their departments
I have a worksheet change procedure in worksheet 1 that does 3 things:
1. Checks if the cell(s) changed are within a specifc range of that worksheet (This will be a dynamic range since rows of data are always added)
2. Compare the changed cell(s) that are within that worksheet's range against a range within the 2nd worksheet (this is also a dynamic range with the list of names changing).
3. Change the offset (2 columns over) of the changed cell in the 1st range with values in the offset of the range in the 2nd worksheet.
Since the ranges in both worksheets are dynamic, I am trying to assign variables depending on where the last row of data is. The main problem is that I cant seem to successfully specify the dynamic named range in worksheet 2 from the worksheet_change procedure of worksheet 1. I get lots of different errors no matter how I declare my variables.
What I have tried to do is declare variables from the worksheet_change procedure of worksheet 1 to find the last row of data for worksheet 2. Then I need to confirm the range I am checking against using the last row. When I declare a variable from the worksheet change I get errors so I am not sure whether there is a smarter way to declare the variable like having a procedure in a module or whether I need to specific the variable that refers to the 2nd worksheet from the worksheet_change procedure in the 1st worksheet.
Any help much appreciated.
Thanks
Steve
I have a worksheet change procedure in worksheet 1 that does 3 things:
1. Checks if the cell(s) changed are within a specifc range of that worksheet (This will be a dynamic range since rows of data are always added)
2. Compare the changed cell(s) that are within that worksheet's range against a range within the 2nd worksheet (this is also a dynamic range with the list of names changing).
3. Change the offset (2 columns over) of the changed cell in the 1st range with values in the offset of the range in the 2nd worksheet.
Since the ranges in both worksheets are dynamic, I am trying to assign variables depending on where the last row of data is. The main problem is that I cant seem to successfully specify the dynamic named range in worksheet 2 from the worksheet_change procedure of worksheet 1. I get lots of different errors no matter how I declare my variables.
What I have tried to do is declare variables from the worksheet_change procedure of worksheet 1 to find the last row of data for worksheet 2. Then I need to confirm the range I am checking against using the last row. When I declare a variable from the worksheet change I get errors so I am not sure whether there is a smarter way to declare the variable like having a procedure in a module or whether I need to specific the variable that refers to the 2nd worksheet from the worksheet_change procedure in the 1st worksheet.
Any help much appreciated.
Thanks
Steve