ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formula string OK, formula not OK (https://www.excelbanter.com/excel-programming/337594-formula-string-ok-formula-not-ok.html)

Roman[_4_]

Formula string OK, formula not OK
 
Please, anybody, donīt you know why this does not work for me?

ActiveCell.formula = "=hyperlink(" & """" & "#'" & Sheets(1).Name &
"'!D" & "1" & """" & ";" & """" & Sheets(1).Name & """" & ")"

Thanks in advance.


Bob Phillips[_6_]

Formula string OK, formula not OK
 
This works for me

ActiveCell.Formula = "=HYPERLINK(""#" & Sheets(1).Name & _
"!D1"";""" & Sheets(1).Name & """)"


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Roman" wrote in message
oups.com...
Please, anybody, donīt you know why this does not work for me?

ActiveCell.formula = "=hyperlink(" & """" & "#'" & Sheets(1).Name &
"'!D" & "1" & """" & ";" & """" & Sheets(1).Name & """" & ")"

Thanks in advance.



Roman[_4_]

Formula string OK, formula not OK
 
Does not for me... shhh... But thank you anyway.

I am always geeting 'Application defined or object defined error'
Any idea?


Roman[_4_]

Formula string OK, formula not OK
 
When I do this:

activecell.value = "HYPERLINK(""#" & Sheets(1).Name & _
"!D1"";""" & Sheets(1).Name & """)"

and then manually replace "hyper" by "=hyper" it works...

When I do the same progrmatically I get 'The formula you typed contain
error'


Very confused.


Bob Phillips[_6_]

Formula string OK, formula not OK
 
I replaced the comma in my working solution with a ; as you had originally
used that, I assumed that was your setting. Perhaps you need comma also, try

ActiveCell.Formula = "=HYPERLINK(""#" & Sheets(1).Name & _
"!D1"",""" & Sheets(1).Name & """)"


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Roman" wrote in message
oups.com...
Does not for me... shhh... But thank you anyway.

I am always geeting 'Application defined or object defined error'
Any idea?




Roman[_4_]

Formula string OK, formula not OK
 
That is it! Thank you much.

Now I see, that when using VBA to create formula I have to put comma
instead ;
which I use when inserting worksheet function manually

Thanks again.


Bob Phillips[_6_]

Formula string OK, formula not OK
 
Of course, even if you are using a setting, VBA works in US format, so you
put a comma, and it will automatically translate to your settings.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Roman" wrote in message
ups.com...
That is it! Thank you much.

Now I see, that when using VBA to create formula I have to put comma
instead ;
which I use when inserting worksheet function manually

Thanks again.




Dave Peterson

Formula string OK, formula not OK
 
If your worksheet has a space in it, then you might want:

ActiveCell.Formula = "=HYPERLINK(""#" & "'" & Sheets(1).Name & "'" & _
"!D1"",""" & Sheets(1).Name & """)"

Those apostrophes won't hurt if they're not needed, but may be required.

Roman wrote:

That is it! Thank you much.

Now I see, that when using VBA to create formula I have to put comma
instead ;
which I use when inserting worksheet function manually

Thanks again.


--

Dave Peterson


All times are GMT +1. The time now is 02:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com