astephanov
New Member
- Joined
- Apr 4, 2009
- Messages
- 19
My company generates the following types of links:
I want to create a custom function that would prompt the user to paste in a link, point to formatted date and give the link a name. All that the user would have to do afterwords is to update the formatted link.
I have a problem with the second function. I tried building the parsing logic (the parsing logic does work on its own) into the IF Then statement, but it get too complicated and I run into problems with the Call function. I thought the above would work, but I does not for some reason. It would be great if both functions could be integrated somehow.
Thank you for help. I really need it.
- [FONT="]http://websrv2/~clearweb/xfer_incoming/cme/f549.cmerpt.rthcycle.20090403[/FONT]
- [FONT="][FONT="]http://websrv2/~clearweb/thpclr_report/20090403/backoffice/BBVA.OPTFUT.customer.PositionCheck.20090403[/FONT][/FONT]
I want to create a custom function that would prompt the user to paste in a link, point to formatted date and give the link a name. All that the user would have to do afterwords is to update the formatted link.
Code:
[FONT="]Function Format_Date(YrDate As Date)[/FONT]
[FONT="]Format_Date = Format(YrDate, "yyyymmdd")[/FONT]
[FONT="]End Function[/FONT]
[FONT="]
[/FONT]
[FONT="]Function IBGLink(URL As String, Formatted_Date As String, Name As String)[/FONT]
[FONT="]Dim A As String[/FONT]
[FONT="] A = Mid(URL, Worksheet.Function.Find("/200", URL), 8)[/FONT]
[FONT="]Dim B As String[/FONT]
[FONT="] B = Left(URL, Worksheet.Function.Find("/200", URL))[/FONT]
[FONT="]Dim C As String[/FONT]
[FONT="] C = Right(URL, Len(URL) - (Len(A) + Len(B)))[/FONT]
[FONT="]Dim D As String[/FONT]
[FONT="] D = Left(C, Worksheet.Function.Find(".200", C))[/FONT]
[FONT="] If Worksheet.Function.IsErr(A) Then[/FONT]
[FONT="] IBGLink = Worksheet.Function.Hyperlink(D & Formatted_Date)[/FONT]
[FONT="] Else: IBGLink = Worksheet.Function.Hyperlink(B & Formatted_Date & D & Formatted_Date)[/FONT]
[FONT="] End If[/FONT]
[FONT="]End Function[/FONT]
I have a problem with the second function. I tried building the parsing logic (the parsing logic does work on its own) into the IF Then statement, but it get too complicated and I run into problems with the Call function. I thought the above would work, but I does not for some reason. It would be great if both functions could be integrated somehow.
Thank you for help. I really need it.