[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 288
  • Last Modified:

Excel Update macros

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
0
goldmineexpert
Asked:
goldmineexpert
1 Solution
 
krishnakrkcCommented:
Hi

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
    MyFormulas = Array("CONTACT2->UCLICKTH0", "CONTACT2->UCLICKTH1", "CONTACT2->UCLICKTH2", "CONTACT2->UCLICKTH3")
    
    
    With ThisWorkbook.Worksheets("Sheet1")  'adjust the sheet name
        For i = LBound(MyRanges) To UBound(MyRanges)
            .Range(MyRanges(i)).Value = WorksheetFunction.Trim(GMMacro(MyFormulas(i)))
        Next
    End With

End Sub

Open in new window


in workbook open module

Option Explicit

Private Sub Workbook_Open()
    
    kTest
    
End Sub

Open in new window


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

Kris
0
 
goldmineexpertAuthor Commented:
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 bobm@contact-mgt.com. Please let me know if you have time today.

Thanks bob mcc
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now