+ Reply to Thread
Results 1 to 6 of 6

VBA Code assistance for Hyperlink populate Loop

  1. #1
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,336

    VBA Code assistance for Hyperlink populate Loop

    Hello World

    I have the following code which opens hyperlink and populates specific sheet with information,saves and closes. This works well for my first hyperlink in Range("C7"). I have hyperlinks down the entire column C. How can I amend code to add a loop to go down column and populate all linked sheets.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,336

    Re: VBA Code assistance for Hyperlink populate Loop

    Hi All

    I've come up with following - Not sure if I am on the right track. Comes up with overflow error. Please HELP

    Please Login or Register  to view this content.
    Last edited by sintek; 07-14-2016 at 09:16 AM.

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,336

    Re: VBA Code assistance for Hyperlink populate Loop

    Change Dim from Integer to Long now code runs non stop in a loop ?

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,336

    Re: VBA Code assistance for Hyperlink populate Loop

    Hi Guys

    Code is now as below. What I need it to do is as follows:

    Open Hyperlink, Select sheet, populate sheet, Save sheet and close.
    Then move down to next row and repeat. I am LOST.

    Please Login or Register  to view this content.
    Last edited by sintek; 07-14-2016 at 12:46 PM.

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,336

    Re: VBA Code assistance for Hyperlink populate Loop

    Hey there World

    I've got my code to run without errors. It is however not populating as it should.

    Please Login or Register  to view this content.

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,336

    Re: VBA Code assistance for Hyperlink populate Loop

    Eureka !!!!. I managed to solve it.

    Sub StatPop()
    Dim RefRow As String
    Dim numRow As Integer
    Dim x As Long
    Application.ScreenUpdating = False
    Application.EnableEvents = False
    Sheets("Payment transactions").Activate
    numRow = 2


    Do While Workbooks("Debtors").Sheets("Payment transactions").Range("c" & numRow).Hyperlinks.Count > 0
    Workbooks("Debtors").Sheets("Payment transactions").Range("c" & numRow).Hyperlinks(1).Follow
    Sheets("Statement").Activate

    RefRow = Workbooks("Debtors").Sheets("Payment transactions").Range("J" & numRow).Value

    If RefRow = "50% Deposit" Then
    Sheets("Statement").Range("b14").Value = Workbooks("Debtors").Sheets("Payment Transactions").Range("I" & numRow).Value
    Sheets("Statement").Range("c14").Value = Workbooks("Debtors").Sheets("Payment Transactions").Range("J" & numRow).Value
    Sheets("Statement").Range("d14").Value = Workbooks("Debtors").Sheets("Payment Transactions").Range("H" & numRow).Value
    Else
    If RefRow = "30% Payment" Then
    Sheets("Statement").Range("b15").Value = Workbooks("Debtors").Sheets("Payment Transactions").Range("I" & numRow).Value
    Sheets("Statement").Range("c15").Value = Workbooks("Debtors").Sheets("Payment Transactions").Range("J" & numRow).Value
    Sheets("Statement").Range("d15").Value = Workbooks("Debtors").Sheets("Payment Transactions").Range("H" & numRow).Value
    Else
    Sheets("Statement").Range("b16").Value = Workbooks("Debtors").Sheets("Payment Transactions").Range("I" & numRow).Value
    Sheets("Statement").Range("c16").Value = Workbooks("Debtors").Sheets("Payment Transactions").Range("J" & numRow).Value
    Sheets("Statement").Range("d16").Value = Workbooks("Debtors").Sheets("Payment Transactions").Range("H" & numRow).Value
    End If
    End If


    ActiveWorkbook.Close SaveChanges:=True



    Sheets("Payment transactions").Activate
    numRow = numRow + 1
    Loop


    Application.ScreenUpdating = True
    Application.EnableEvents = True

    End Sub

+ 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. Hyperlink Assistance, Please
    By Sunnypat in forum Excel General
    Replies: 8
    Last Post: 06-15-2015, 02:51 AM
  2. how can i loop this code through each row (populate and submit an HTML form)
    By GHIREM in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-19-2015, 07:39 PM
  3. Assistance needed to loop code when pulling info from a web page and pasting to excel
    By boswelljw in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2015, 09:49 AM
  4. Do While Loop Code Assistance
    By cdscivic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-02-2014, 10:48 AM
  5. For Loop assistance
    By Paliza in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-02-2012, 05:01 AM
  6. Replies: 3
    Last Post: 02-20-2012, 09:45 AM
  7. Assistance with Loop
    By mauddib13 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-20-2008, 06:25 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