View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
bturner2[_2_] bturner2[_2_] is offline
external usenet poster
 
Posts: 1
Default Help creating link & formula from user input

Thanks for the help Mr. Pearson. It all worked the way it was suppose
to work. I am however having one problem. The code for the IF statemen
formula is being run by the code itself. I actually needed to inser
the formula into a cell. Not saying that I didn’t find the informatio
you gave me useful. I did. It actually answered another question that
had.
Let me explain in more detail of what and why I am doing this.
This sheet is to track sick leave for approx 200 employees. On th
front sheet will be all of the employee’s names which are hyperlinks t
their own page. Beside the names (hyperlink) I needed to insert th
formula to give the person managing the sheet a quick reference as t
what state of discipline the person is in.
If the person has X amount of hours of sick leave it will displa
“Informational” beside their name, Z amount of hours it will display
Written" and so on and so forth.

I did play with what you posted concerning the IF statement, and I hav
it inserting the formula into the cell using the variable that is give
by the user. It however is placing single quotes around the cel
reference which causes the formula to malfunction.

Here is the code I am using for this step.
ActiveCell.FormulaR1C1 = "=IF(" & MyInput & "!G279,""Discharge"",IF(
& MyInput & "!G271,""Final""," & _
"IF(" & MyInput & "!G263,""Second"",IF(" & MyInput
"!G255,""First""," & _
"IF(" & MyInput & "!G231,""Informational"","""")))))"

Here is the result that is being placed in the cell.
=IF(turner!'G2'79,"Discharge",IF(turner!'G2'71," Final",IF(turner!'G2'63,"Second",IF(turner!'G2'5 5,"First",IF(turner!'G2'31,"Informational","")))) )

Whats wrong with the code? As I said I am new

--
Message posted from http://www.ExcelForum.com