Help with VBA or a Macro for my accounts spreadsheet

  • Hi,


    Firstly, I want to say that I am not an advanced user of excel, but I can get myself around most things.



    I have a spreadsheet that I enter invoice numbers in column B of my spreadsheet. In column C I have the following hyperlink:


    =IF(B3="","",HYPERLINK(FileLocation&DriveLetter&FileLocation2&B3&".pdf",B3))


    The above hyperlink is representative of what is in cell C3. This is copied all the way down column C and the ‘B3’ above, just increments as the cells go down column C.



    FileLocation = ‘file://


    DriveLetter= C:


    FileLocation2= '\Users\Andrew\OneDrive\Documents\Accounts\2018 Accounts\Invoices 2018\


    [TABLE="border: 1, cellpadding: 1, width: 500"]

    [tr]


    [td][/td]


    [td]

    B (Invoice No.

    [/td]


    [td]

    C (Hyperlink is in this column

    [/td]


    [/tr]


    [tr]


    [td]

    1

    [/td]


    [td]

    1655

    [/td]


    [td]

    =IF(B1="","",HYPERLINK(FileLocation&DriveLetter&FileLocation2&B1&".pdf",B1))

    [/td]


    [/tr]


    [tr]


    [td]

    2

    [/td]


    [td]

    1656

    [/td]


    [td]

    =IF(B2="","",HYPERLINK(FileLocation&DriveLetter&FileLocation2&B2&".pdf",B2))

    [/td]


    [/tr]


    [tr]


    [td]

    3

    [/td]


    [td]

    1658

    [/td]


    [td]

    =IF(B3="","",HYPERLINK(FileLocation&DriveLetter&FileLocation2&B3&".pdf",B3))

    [/td]


    [/tr]


    [tr]


    [td]

    4

    [/td]


    [td]

    1651

    [/td]


    [td]

    =IF(B4="","",HYPERLINK(FileLocation&DriveLetter&FileLocation2&B4&".pdf",B4))

    [/td]


    [/tr]


    [/TABLE]


    The above works fine, but it uses up 2 columns of my workbook. What I would like to do is just enter an invoice number in column B and when I press on it, it will open a PDF file that represents the invoice number.


    Is there a solution to this problem?


    Kind Regards


    Andrew

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!