Excel Update macros

Posted on 2012-09-20
Last Modified: 2012-10-04
I need to add this value to a specific cell then "hard code the results" . Basically the results replace this value. The macro below is from the Goldmine software link with excel. If you use this link currently it replaces the data each time you open the file with the current data in goldmine. I might have 20 of these macros per worksheet.

=TRIM(GMMacro("CONTACT2->UCLICKTH0"))  goes in A1
=TRIM(GMMacro("CONTACT2->UCLICKTH1")) goes in b5
=TRIM(GMMacro("CONTACT2->UCLICKTH2")) goes in c 3
=TRIM(GMMacro("CONTACT2->UCLICKTH3")) goes in d 4

I in-vision a script that will auto populate all the macros the somehow remove themselves once the data is populated.

Look forward to any questions. Thanks bob
Question by:goldmineexpert
    LVL 18

    Accepted Solution


    Try something like this

    in a standard module.

    Option Explicit
    Sub kTest()
        Dim MyRanges, MyFormulas, i As Long
        MyRanges = Array("a1", "b5", "c3", "d4")
        'the formulas must sequence with respect to your ranges
        With ThisWorkbook.Worksheets("Sheet1")  'adjust the sheet name
            For i = LBound(MyRanges) To UBound(MyRanges)
                .Range(MyRanges(i)).Value = WorksheetFunction.Trim(GMMacro(MyFormulas(i)))
        End With
    End Sub

    Open in new window

    in workbook open module

    Option Explicit
    Private Sub Workbook_Open()
    End Sub

    Open in new window

    To test the results, place the cursor in between workbook_open sub and hit F5.


    Author Comment

    Hey Kris,

    I would like you to work on this project for me. Do you have time to chat today via phone?

    My email is Please let me know if you have time today.

    Thanks bob mcc

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
    Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
    Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
    This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now