+ Reply to Thread
Results 1 to 12 of 12

Populating values from one sheet to other sheet with VBA code with a created link.

  1. #1
    Registered User
    Join Date
    05-22-2022
    Location
    Nigeria
    MS-Off Ver
    2016 (A Noob)
    Posts
    51

    Populating values from one sheet to other sheet with VBA code with a created link.

    Please help with populating values from one sheet to other sheet with VBA code with a created link. I have data in Home(sheet name) range A2:B4. What i wish to achieve is this, with a VBA code if Home(sheet name) cell A2 is not empty then an hyperlink or link whichever is created in Home(sheet name) cell C2 with a name "Click", when you Click on it will take you to View(sheet name) and populate the values in Home(sheet name) cell A2 and cell B2 in View(sheet name) cell A2 and Cell B2 respectively but if Home(sheet name) cell A2 is empty then Cell C2 home(Sheet Name) is empty and no link created. Same applies to other range not empty from range A2:B4. thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,303

    Re: Populating values from one sheet to other sheet with VBA code with a created link.

    Not quite sure what it is you're trying to accomplish, but possibly...

    Place this code in a standard code module...
    Please Login or Register  to view this content.
    ...and place this code in the HOME worksheet code module...
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-22-2022
    Location
    Nigeria
    MS-Off Ver
    2016 (A Noob)
    Posts
    51

    Re: Populating values from one sheet to other sheet with VBA code with a created link.

    I have uploaded the VBA file and my effort but can't get the result. I want to populate the value in Worksheets("HOME") cell A2 and B2 in Worksheets("VIEW") cell A2 and B2 when you click on a link in Worksheets("HOME") cell C2 also populate the value in Worksheets("HOME") cell A3 and B3 in Worksheets("VIEW") cell A3 and B3 when you click on a link in Worksheets("HOME") cell C3 etc..

    The Code is in the module and below as well

    Sub Hyperlink_stats_1()

    Worksheets("HOME").Select
    Range("C2").Select

    If Range("A2").Value = "" Then
    Range("C2").Value = ""
    Else

    ActiveCell.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:="'VIEW'!A1", TextToDisplay:="CLICK"

    Worksheets("VIEW").Range("A2").Value = Worksheets("HOME").Range("A2").Value
    Worksheets("VIEW").Range("B2").Value = Worksheets("HOME").Range("B2").Value

    End If

    Call Hyperlink_stats_2

    End Sub

    Sub Hyperlink_stats_2()

    Worksheets("HOME").Select
    Range("C3").Select

    If Range("A3").Value = "" Then
    Range("C3").Value = ""
    Else

    ActiveCell.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:="'VIEW'!A1", TextToDisplay:="CLICK"

    Worksheets("VIEW").Range("A2").Value = Worksheets("HOME").Range("A3").Value
    Worksheets("VIEW").Range("B2").Value = Worksheets("HOME").Range("B3").Value

    End If


    End Sub
    Attached Files Attached Files
    Last edited by mansh34; 10-02-2023 at 11:22 AM.

  4. #4
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,303

    Re: Populating values from one sheet to other sheet with VBA code with a created link.

    Attached is a file with the code from above.

    If it doesn't do what you want, then please submit a file without code, showing the data before any code runs and the results you expect after the code runs.
    Attached Files Attached Files
    Last edited by dangelor; 10-09-2023 at 07:44 AM.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Populating values from one sheet to other sheet with VBA code with a created link.

    mansh34,

    Here's my interpretation of your question.
    It will create/delete hyperlink if you change any cells(2) in A2:B4.
    1) to ThisWorkbook code modue
    Please Login or Register  to view this content.
    2) to HOME sheet code module
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-22-2022
    Location
    Nigeria
    MS-Off Ver
    2016 (A Noob)
    Posts
    51

    Re: Populating values from one sheet to other sheet with VBA code with a created link.

    Almost close, that was great. But they are populating in different rows in view(sheet), I want it to populate in same row in view(sheet) when you click on any of the links created in home(sheet). Again how can I modify the data in home(sheet) from single column A to double columns A and B, and get any of the links click populate in the same cell let’s say cell A2 and B2 Thank you in advance

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Populating values from one sheet to other sheet with VBA code with a created link.

    Then change one line
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    05-22-2022
    Location
    Nigeria
    MS-Off Ver
    2016 (A Noob)
    Posts
    51

    Re: Populating values from one sheet to other sheet with VBA code with a created link.

    Yes, I have it now, how can I modify to have more rows and columns on the home(sheet)?
    Last edited by mansh34; 10-20-2023 at 06:48 AM.

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Populating values from one sheet to other sheet with VBA code with a created link.

    What do you mean?

    Upload a workbook, and I may see what you are trying to say.

  10. #10
    Registered User
    Join Date
    05-22-2022
    Location
    Nigeria
    MS-Off Ver
    2016 (A Noob)
    Posts
    51

    Re: Populating values from one sheet to other sheet with VBA code with a created link.

    i have uploaded a file.
    Attached Files Attached Files

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Populating values from one sheet to other sheet with VBA code with a created link.

    Delete all the codes you tried to modify, I guess, in HOME sheet module and replace with
    Please Login or Register  to view this content.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  12. #12
    Registered User
    Join Date
    05-22-2022
    Location
    Nigeria
    MS-Off Ver
    2016 (A Noob)
    Posts
    51

    Re: Populating values from one sheet to other sheet with VBA code with a created link.

    Yes friend, so sorry for late reply. This is what i really want, you nailed it yeah. i was trying to substitute from start of cell A2 & B2(Home) to either cell C10 & G10 (Home) and get it populate in G7 & J7 (View). Also i want the "Click" created to be empty each time the corresponding cells are empty, i couldn't figure it out. Please don't leave me here. thanks in advance.
    Last edited by mansh34; 12-27-2023 at 02:48 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Data from different sheet populating into Summary sheet when new sheets are created
    By TaranakiGirl in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-24-2020, 07:15 PM
  2. Update Values to an Existing Sheet from every new Sheet created by Macro
    By DespitePain in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-06-2018, 02:50 AM
  3. Link cells of automatically created sheet to already existing sheet
    By franklinu in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-08-2015, 10:24 PM
  4. Replies: 1
    Last Post: 12-14-2012, 01:56 PM
  5. Attach code to each sheet and if a new sheet is created add the code to this automatically
    By Irish RayRay in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-13-2012, 08:33 AM
  6. How Do I save a Camera Icon Dynamic Picture Link created in the Sheet itself?
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-15-2011, 01:58 PM
  7. Populating a report sheet based on imported values on another sheet
    By th3spankst3r in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-05-2010, 06:19 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