Saturday 15 January 2011

excel - adding a dynamic cell reference in vba -



excel - adding a dynamic cell reference in vba -

i using next code insert formula cell using vba. code inserts hyperlink static text leading file path , @ end of file path want able add together dynamic cell reference, instance , number of row.

in cell in column have names of folders. using destrow define current row number. question how can right formula when link clicked opens link right folder name of row clicked? thanks

ws2.range("s" & destrow).formula = "=hyperlink(""\\uksh000-file06\purchasing\new_supplier_set_ups_&_audits\attachments\"" & k" & destrow & ",""attached"")"

try,

ws2.range("s" & destrow).formula = "=hyperlink(""\\uksh000-file06\purchasing\new_supplier_set_ups_&_audits\attachments\" & ws2.range("k" & destrow).value & """,""attached"")"

fwiw, hate working quoted strings well.

addendum: should adding static filename after dynamic folder:

ws2.range("s" & destrow).formula = "=hyperlink(""\\uksh000-file06\purchasing\new_supplier_set_ups_&_audits\attachments\" & ws2.range("k" & destrow).value & "\audit.xls"",""attached"")"

excel vba hyperlink

No comments:

Post a Comment