Hi All,
I am looking for a macro that will open up a pdf file based on the value of a given cell.
The macro will be run as a button, along with some other macros.
An example of my data is provided below.
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Code[/TD]
[TD]Name[/TD]
[TD]Sector[/TD]
[TD]Recommendation[/TD]
[TD]Transaction[/TD]
[TD]Subsequent Holding[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]ABCD123[/TD]
[TD]ABC Fund[/TD]
[TD]A[/TD]
[TD]Retain[/TD]
[TD]$0[/TD]
[TD]$100[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]EFGH123[/TD]
[TD]EFG Fund[/TD]
[TD]B[/TD]
[TD]Buy[/TD]
[TD]$100[/TD]
[TD]$100[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]IJKL123[/TD]
[TD]IJK Fund[/TD]
[TD]C[/TD]
[TD]Top-up[/TD]
[TD]$50[/TD]
[TD]$150[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]MNOP123[/TD]
[TD]MNO Fund[/TD]
[TD]D[/TD]
[TD]Sell[/TD]
[TD]-$100[/TD]
[TD]$0[/TD]
[/TR]
</tbody>[/TABLE]
Essentially I am looking to open the associated file based on whether the vale in column E is above $0.
In the above example, I would want to open the files that are associated with the EFG Fund and the IJK Fund
File locations are:
C:/Program Files/Fund Fact Sheets/"Code" Fact Sheet (e.g. ABCD123 Fact Sheet)
Now for the wish list:
1. While the data (and positioning) in columns A:C may remain relatively static, there will be scenarios where it can change, and I would love to not have to update the Macro each time this occurs. In this regard, is it possible to base a macro on looking for positive values in column E and then opening the appropriate file based on the code in column A?
2. There may also be times where there isn't a corresponding file and it would be great if an Error message comes up detailing the code it could not open a file for.
3. There are occurrences of codes in column A which have 5 characters or less. These codes will not have a corresponding file, so regardless of whether there is a positive value in column E or not, no error message is needed.
Thanks in advance for any assistance.
I am looking for a macro that will open up a pdf file based on the value of a given cell.
The macro will be run as a button, along with some other macros.
An example of my data is provided below.
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Code[/TD]
[TD]Name[/TD]
[TD]Sector[/TD]
[TD]Recommendation[/TD]
[TD]Transaction[/TD]
[TD]Subsequent Holding[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]ABCD123[/TD]
[TD]ABC Fund[/TD]
[TD]A[/TD]
[TD]Retain[/TD]
[TD]$0[/TD]
[TD]$100[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]EFGH123[/TD]
[TD]EFG Fund[/TD]
[TD]B[/TD]
[TD]Buy[/TD]
[TD]$100[/TD]
[TD]$100[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]IJKL123[/TD]
[TD]IJK Fund[/TD]
[TD]C[/TD]
[TD]Top-up[/TD]
[TD]$50[/TD]
[TD]$150[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]MNOP123[/TD]
[TD]MNO Fund[/TD]
[TD]D[/TD]
[TD]Sell[/TD]
[TD]-$100[/TD]
[TD]$0[/TD]
[/TR]
</tbody>[/TABLE]
Essentially I am looking to open the associated file based on whether the vale in column E is above $0.
In the above example, I would want to open the files that are associated with the EFG Fund and the IJK Fund
File locations are:
C:/Program Files/Fund Fact Sheets/"Code" Fact Sheet (e.g. ABCD123 Fact Sheet)
Now for the wish list:
1. While the data (and positioning) in columns A:C may remain relatively static, there will be scenarios where it can change, and I would love to not have to update the Macro each time this occurs. In this regard, is it possible to base a macro on looking for positive values in column E and then opening the appropriate file based on the code in column A?
2. There may also be times where there isn't a corresponding file and it would be great if an Error message comes up detailing the code it could not open a file for.
3. There are occurrences of codes in column A which have 5 characters or less. These codes will not have a corresponding file, so regardless of whether there is a positive value in column E or not, no error message is needed.
Thanks in advance for any assistance.