vba

PowerQuery table refresh stops with an error

自古美人都是妖i 提交于 2021-02-08 10:00:34
问题 I have experienced several time situation where using power query and refreshing large table (~300K rows) it stops loading rows with an error: Error Message: The MashupResource's PageReader is not available. Stack Trace: System.InvalidOperationException: The MashupResource's PageReader is not available. at Microsoft.Mashup.Client.Excel.FillManager.RefreshFillSession.GetSchemaInfo() at Microsoft.Mashup.Client.Excel.FillManager.RefreshFillSession.CompleteRefresh(IWorkbook workbook, Boolean

Running SQL file from VBA

不羁的心 提交于 2021-02-08 09:50:10
问题 I'm currently trying to figure out how to run a .sql file from VBA. I can get the VBA to run sql code inside it, but as I have the SQL script already wrote, I'd like to just be able to call the file, run the code and pass the data back to Excel. Even if it's calling the file and passing the code back to VBA to run, that'd be fine, but it's just easier to maintain the code there instead of in the VBA editor. Database is Oracle, but I've got the connection running and working atm. ' Makes the

ListBox Form Control Scrolling

久未见 提交于 2021-02-08 09:36:05
问题 I've been doing a ton of research and I'm finally giving in and hoping the community can help. I have a FORM CONTROL list box, not an active x. I'm intentionally using form control for a variety of reasons that are not necessarily important (unless you can guide me how to 100% ensure activeX controls don't resize themselves on workbook open). I cannot, for the life of me, figure out how to get the form control list box to scroll to the selected value and put it in view. Here is what I have:

VBA to update formula when a value changes in a refence range

◇◆丶佛笑我妖孽 提交于 2021-02-08 09:29:50
问题 I have an Excel formula that gives me the last Friday's date "=TODAY()-WEEKDAY(TODAY())-1" in cell A1 I want to update cell A1 only when the values in reference range in another worksheet B2:D469 changes. Below is the code i am using but the issue is code only works when i manually make a change in the range. However values in the range gets updated when source pivot table refresh. I want code to get updated when i refresh the pivot table and the values in the range "B2:D469" changes. Private

VBA Run-time error -214724809 (80070057)

笑着哭i 提交于 2021-02-08 09:00:31
问题 I want fill a drop down list based on user selection in another. I'm trying to update the contents of a field based on selection in another by adding the items on the fly once the first combobox (cbo_park) is selected. I have a four drop down lists: The first drop down cbo_park has the following options: Central East West I have a second workbook called lookupRoom which contains the following table: roomCode park A.0.01 Central A.2.01 Central A.3.01 Central HE.0.10 East HE.0.21 East HE.0.22

Search via textbox to auto-update listbox entries

隐身守侯 提交于 2021-02-08 08:52:07
问题 I would like to implement a search function in a listbox in a userform getting a better view of the many columns and unfortunately I can't find a solution. The optimal solution would be, if I could search in a textbox for any row content (up to 12 columns containing data like e.g. name, ID, position, organization, ...) and the listbox would automatically update itself showing all matching entries. In UserForm_Initialize I filled the listbox as follows: Private Sub UserForm_Initialize() With

Cannot able to store value in a array - VBA

寵の児 提交于 2021-02-08 08:50:19
问题 I am trying to store a filename in a array but i am getting Type mismatch error. I have changed the data type but it didn't work. Kindly help. The code block that is throwing error, Sub Example2() Dim objFile,objFile1,objFolder,objFolder1 As Object Dim splitting, counter, filename, filename1, splitting1, counter1,As Variant Dim myarray() As Variant For Each objFile In objFolder.Files splitting = Split(objFile.Name, "\", 9) counter = UBound(splitting) filename = splitting(counter) For Each

VBA code to open all excel files in a folder

三世轮回 提交于 2021-02-08 08:44:20
问题 I was working with a vba and I'm trying to open all excel files in a folder (about 8-10) based on cell values. I was wondering if this is the right approach to opening it, it keeps giving me syntax error where I wrote the directory. and when I rewrote that section, the vba only shot out the msgbox which meant it had to have looped and did something right? but didn't open any files. Any information will help. Thank you guys so much for taking the time to help me in any way. Sub OpenFiles() Dim

Outlook macro to delete and move original email when replied to

不打扰是莪最后的温柔 提交于 2021-02-08 08:41:26
问题 I'm trying to implement this code but it's not working, Please advise. I've New Ticket folder, once replied from the New Ticket folder mails have to be moved to Completed folder Code I'm looking for, Macro that directly moves all the replied email to a completed folder. Getting error message at : olMail.Move olDestFolder ' move to InProgress folder Code I'm using: Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) Dim olNameSpace As Outlook.NameSpace Set olNameSpace =

VBA find/replace using array for cell range

女生的网名这么多〃 提交于 2021-02-08 08:25:56
问题 I receive a quarterly data set where I need to make some general changes to the data. The changes are routinely the same and I want to use a macro to change them in one fell swoop rather than find/replace manually. I found a script that saves my data as an array and then searches the entire workbook. It works BUT I only want it to find/replace in a specific range. I've tried many times to alter the code, but I am unable to. I don't even know if this is the best way to accomplish it - very