sassriverrat
Well-known Member
- Joined
- Oct 4, 2018
- Messages
- 655
Hello-
I have a macro that allows me to reference a cell in a previous sheet in formulas. However, I’d like to know if anyone has any ideas on how to write the code for the following-
My workbook creates one of two sheets based on user selection. If sheet one is written, the formulas in the second sheet can easily reference the first sheet (=if(prevsheet(A2)=“”,’voyage’!A1,prevsheet(A1) for example). However, if the second sheet is created, there isn’t a first sheet to reference in the formula. So basically the formula would be just =‘voyage’!A2 on sheet2 but I’m not sure how to tell the cell to use on formula versus the other. A simple “IF Then” would work IF sheet1 had one static name, but technically speaking, sheet1 goes by “Noon” and then a number, based on the number of times the original sheet is copied. The last “Noon” is the previous sheet to reference, but because it can be Noon (if only one sheet1 is created) or Noon10, I don’t know how to tell it to choose the formula based on a “Noon” sheet existing. Thanks. And I can clarify if someone needs it.
I have a macro that allows me to reference a cell in a previous sheet in formulas. However, I’d like to know if anyone has any ideas on how to write the code for the following-
My workbook creates one of two sheets based on user selection. If sheet one is written, the formulas in the second sheet can easily reference the first sheet (=if(prevsheet(A2)=“”,’voyage’!A1,prevsheet(A1) for example). However, if the second sheet is created, there isn’t a first sheet to reference in the formula. So basically the formula would be just =‘voyage’!A2 on sheet2 but I’m not sure how to tell the cell to use on formula versus the other. A simple “IF Then” would work IF sheet1 had one static name, but technically speaking, sheet1 goes by “Noon” and then a number, based on the number of times the original sheet is copied. The last “Noon” is the previous sheet to reference, but because it can be Noon (if only one sheet1 is created) or Noon10, I don’t know how to tell it to choose the formula based on a “Noon” sheet existing. Thanks. And I can clarify if someone needs it.