Results 1 to 3 of 3

User Form - Hyperlink Button within a Form, to create a Link on a Designated Cell

Threaded View

Sinalk User Form - Hyperlink Button... 08-27-2013, 06:19 AM
Andy Pope Re: User Form - Hyperlink... 08-27-2013, 06:56 AM
Sinalk Re: User Form - Hyperlink... 08-27-2013, 07:29 AM
  1. #1
    Registered User
    Join Date
    07-30-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    11

    User Form - Hyperlink Button within a Form, to create a Link on a Designated Cell

    Hi,

    Introduction:
    I have just started using Excel VBA and am slowly learning the program for a project at work, using online tutorials, watching Macros being recorded and this really helpful forum.

    However I need help, as I can not get my head around how I should do the following:

    Issue:
    I am currently creating a user form in which an individual can type in several variables and at the click of a button, the software, will paste the information on to the spreadsheet.
    However I want to be able to create a command button within the user form that when clicked will:
    1. Input a text, e.g. "Resume".
    2. Prompt the Hyperlink Dialogue Window to Appear.
    3. Individual selects appropriate document and clicks 'OK'.
    4. When Individual closes the user form, the next available empty row and cell is populated with the text "Resume" and the corresponding Hyperlink.

    Current Solution:
    Currently for the 'Hyperlink Command Button' within the user form, I have utilised the following Excel VBA code:

    Private Sub InsertHyperlinkCommandButton_Click()
    
    Dim emptyRow As Long
            
        'Make Sheet1 Active
        Sheets(1).Activate
        
        'Determine emptyRow
        emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
           
        'Export Data to worksheet
        If Application.Dialogs(xlDialogInsertHyperlink).Show Then
        Cells(emptyRow, 5).Value = "Resume"
        End If
    
    End Sub
    & The following happens:
    1. User clicks the command button - 'InsertHyperlinkCommandButton'
    2. Text value of "Resume" inputs itself on the next available empty row, on column 5.
    3. The Hyperlink Dialogue Window Appears
    4. User selects their required document and clicks 'OK'
    5. Hyperlink is created but on the last highlighted cell, not on the next available empty row, on column 5.

    I think that the reason why the hyperlink is not being pasted on to the required cell is down to the 'Export Data to worksheet' part of the VBA code. However I can not figure out what I should be typing instead.

    Other:
    I have attached an example worksheet of the VBA Code that I have shown above in working practice, below, as I am restricted on not being allowed to upload anything to do with work.
    Example - Userform.xlsm

    Thank you in advance.
    Sinalk
    Last edited by Sinalk; 08-27-2013 at 06:24 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Link Form Control Button to Cell Location?
    By bennetas in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-22-2016, 07:48 AM
  2. Link User Form Text Box to worksheet cell
    By jamphan in forum Excel General
    Replies: 11
    Last Post: 07-20-2014, 10:45 AM
  3. vba user form to create message depend on option button/check box
    By young_86 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-03-2013, 06:12 AM
  4. How to link user form to cell with formula
    By earlewallbank in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 04-03-2013, 03:16 PM
  5. Is it possible to read a form button location or cell link?
    By ifwhitfi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-15-2012, 04:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1