excel-vba

VBA EXCEL GOOGLE LOOKUP

十年热恋 提交于 2020-01-05 09:12:27
问题 I found some VBA excel code that allowed the range of key words to be looked up on google and returned the first link. I want to add an input box in the beginning to say get the top 5 links. I have 2000 key words that i need to search on google and return the top few links. Can someone please help me expand this code in order to do that???? Thank you so much! Here is the code provided by another stackoverflow user: Sub XMLHTTP() Dim url As String, lastRow As Long Dim XMLHTTP As Object, html

Excel Macro - Test if Power Query for Excel Addin in installed

六眼飞鱼酱① 提交于 2020-01-05 09:09:01
问题 Is it possible to test if "Power Query for Excel" add-in is installed and enable using excel macros ? I'd like to use it to authorize the Data refreshing of my workbook which is connected to several data sources using this add-in. Thanks and Regards. 回答1: You could use something like this, as it's a COM add-in: Function IsPowerQueryAvailable() As Boolean Dim bAvailable As Boolean On Error Resume Next bAvailable = Application.COMAddIns("Microsoft.Mashup.Client.Excel").Connect On Error GoTo 0

Excel Macro - Test if Power Query for Excel Addin in installed

坚强是说给别人听的谎言 提交于 2020-01-05 09:08:44
问题 Is it possible to test if "Power Query for Excel" add-in is installed and enable using excel macros ? I'd like to use it to authorize the Data refreshing of my workbook which is connected to several data sources using this add-in. Thanks and Regards. 回答1: You could use something like this, as it's a COM add-in: Function IsPowerQueryAvailable() As Boolean Dim bAvailable As Boolean On Error Resume Next bAvailable = Application.COMAddIns("Microsoft.Mashup.Client.Excel").Connect On Error GoTo 0

Handling the prompts of another Add-In

我们两清 提交于 2020-01-05 09:07:32
问题 The following code, which is part of an Excel Add-In that I created, will create a file name of the current data extract that we have open. Sub ExtractSave() ' If InStr(LCase$(ActiveWorkbook.name), "extract") > 0 Then Exit Sub Else Dim MyDir As String, fn As String MyDir = CreateObject("WScript.Shell").SpecialFolders("MyDocuments") & "\Extract Files" ' change this to valid path If Len(Dir(MyDir, vbDirectory)) = 0 Then MkDir MyDir fn = MyDir & "\Extract - " & Format(Now, "mm-dd-yyyy hh_mm")

Loop through Excel sheets in a single workbook

妖精的绣舞 提交于 2020-01-05 08:53:08
问题 I have the following code and I would like it to delete all rows that contain some specific text, for example, "Statement No****" , followed by any text. I would like to do this for each sheet in the workbook. My problem is that the code below is working just for active tab, not others. Please assist me so that it automatically loops through all worksheets. Sub doit() Application.DisplayAlerts = False Dim i As Integer Dim r As Long, lr As Long Dim x As Integer x = Sheets.Count For i = x To 1

Most efficient way to add cell values across congruent ranges in VBA?

点点圈 提交于 2020-01-05 08:31:54
问题 I need to sum the values two ranges of arbitrary (but identical) sizes. A1 in input1 gets summed with A1 in input2, then output to A1 in the output cell, etc. I need the end values, not formulas or links. Using a loop this is much, much slower than expected (currently 15+ minutes.) It does not take that long to do it manually. Maybe I could pre-make some hidden worksheets filled an addition formula and then in VBA essentially mimic how a human would manually do it but it feels ass-backwards.

Most efficient way to add cell values across congruent ranges in VBA?

心已入冬 提交于 2020-01-05 08:31:47
问题 I need to sum the values two ranges of arbitrary (but identical) sizes. A1 in input1 gets summed with A1 in input2, then output to A1 in the output cell, etc. I need the end values, not formulas or links. Using a loop this is much, much slower than expected (currently 15+ minutes.) It does not take that long to do it manually. Maybe I could pre-make some hidden worksheets filled an addition formula and then in VBA essentially mimic how a human would manually do it but it feels ass-backwards.

Strange ways comparisons occur

时间秒杀一切 提交于 2020-01-05 08:24:44
问题 This is something strange that I've come across looking at this question here: Issue with VBA Excel number formatting I thought I might expand on it and see if anyone can explain. Lets say I have an Excel document with 5 cells in column A all with the value 1234 The first is formatted with the format string "000000000" The second is formatted using Excel's "Number" format The third is formatted as Excel's "General" format The fourth is formatted as "Text" The fifth is formatted as "Text" but

Excel VBA Using wildcard to replace string within string

穿精又带淫゛_ 提交于 2020-01-05 08:02:12
问题 I have a difficult situation and so far no luck in finding a solution. My VBA collects number figures like $80,000.50. and I'm trying to get VBA to remove the last period to make it look like $80,000.50 but without using right(). The problem is after the last period there are hidden spaces or characters which will be a whole lot of new issue to handle so I'm just looking for something like: replace("$80,000.50.",".**.",".**") Is this possible in VBA? 回答1: I cant leave a comment so.... what

Reset a field based on selection of another in VBA

谁都会走 提交于 2020-01-05 07:57:07
问题 I have a drop down field in VBA called cbo_deptCode . I would like another set of fields called cbo_moduleCode and cbo_moduleName to be cleared of any current entry each time the user makes a selection from the drop down cbo_deptCode . The combo boxes are form controls. How can I go about achieving this? 回答1: Assign a macro to cbo_deptCode. In the macro have code like the following: Sub cbo_deptCode_Change() 'Update selected index for combo boxes to 0 I.E. no selection ActiveSheet.Shapes("cbo