I would like to write my own macro / function in VBA for Excel that introduces a new "formula" JIRA(ISSUE_ID)
in Excel so that I can use
=JIRA("ISSUE_ID")
in a cell and it renders the following link (pseudo Markdown syntax)
[ISSUE_ID](http://my.jira.com/browse/ISSUE_ID)
in the very same cell, where [ISSUE_ID]
is the link text to be shown in the cell and (http://my.jira.com/tracker/ISSUE)
is the URL for the link.
Here is an example that hopefully clarifies my needs:
I use the "formula" =JIRA("ABC-1234")
and what my VBA function should do, is rendering a hyperlink into the very same cell that holds this formula which shows ABC-1234 as the content of the cell which is a hyperlink to http://my.jira.com/browse/ABC-1234
.
In VBA pseudo-code, my function writes like this:
Function JIRA(issue_id)
current_cell = cell_in_which_this_function_is_used_as_formula()
url = "http://my.jira.com/browse/" + issue_id
current_cell.content = issue_id 'text to be shown in the cell
current_cell.hyperlink = url 'hyperlink to be used for the cell
End Function
I can achieve the same result with =HYPERLINK("http://my.jira.com/browse/ISSUE", "ISSUE")
but I don't want to write this lengthy function every time. I also don't want to use 2 columns to achieve this (e.g. =Hyperlink("http://my.jira.com/" & B1,B1)
).