Originally Posted by
kytung
Thanks Karmapala,
Reading the sample code, it looks like it takes the template file and allow me to type values with input box.
then it generates a new sheet after the old sheet,
and replaces all the references that say "!A" with the new reference column.
YEs you are correct.
In other words, sheet "Input" column A is just for the sheet "Template" reference.
I'm not too familiar with .Address but I'm assuming that it returns the column letter.
Correct.
If I change up my template and it only references column B, could I just replace the !A with !B and still have it working?
I haven't tried it yet. But logically, yes it should still run if the formula in sheet "Template" column A is referencing
to column B in sheet "Input".
So assumed that sheet "Template" formula reference is to column B (after row 1) of sheet "Input",
the next new column will be column C of sheet "Input", where row 1 is the name of the new sheet,
and the rest of the rows is the value the user input.
Just remember that you need to change this line :
into
So, when you run the code, it will replace the !B to !C.
If you don't change that line (it's still !A), the code won't work
because it won't find "!A" in the newly_created_sheet_with_the_pasted_formula_from_sheet_template
to be replaced with "!C".
I didn't expect the code to be so short.
I guess in my head it seems much
more complicated than it actually is.
I think as long as the formula in sheet "Template" is always referencing to whatever_column in sheet "Input",
and the line
is referencing to What:="!whatever_column",
then I think the code should still work no matter how complicated is the formula in sheet "Template".
I'll give it a try tonight and see if it does what I think it does.
Please do.
I hope the code still can give you the result as you expected.
Bookmarks