excel-vba

Excel renaming Activex Controls on other computers

蹲街弑〆低调 提交于 2019-12-31 05:30:11
问题 I have a worksheet with Activex Controls(Combobox, Command Button, Option Button, CheckBox). On my computer I have renamed all the controls (Ex. CButtonPMR, OButton_Comp, etc) But when I open the file on other computer all the controls are renamed to default the default names (CheckBox1,Checkbox2, CommandButton1, etc) For that reason the code doesn't works on other computers. I am getting errors every time because the code can't compile. Is there a way to fix this? I basically have 2 forms

How to run a macro on some but not all sheets in a workbook?

耗尽温柔 提交于 2019-12-31 05:25:33
问题 I have a workbook that contains worksheets for each industry group in the S&P 500 and wrote the macro below to update all the stock information on them when I press a command button on the first worksheet. The macro works perfectly, but when I go to add additional sheets that I do not want to update with this macro it stops working. I tried using the "If Not" statements below, but it did not seem to work. Sub Get_Stock_Quotes_from_Yahoo_Finance_API() 'Run the API for every sheet in the

IE Web Automation - How to enter catcha while using New XMLHTTP post request method

≡放荡痞女 提交于 2019-12-31 05:25:13
问题 I'm a beginner. I tried but failed to pull web page response while using xmlhttprequest post method. I'm trying to fill web form using excel file by making a query string but its not working. I don't know whether querystring is correct and don't know how to enter captcha? Value of captcha can be seen by inspecting element. I'll be grateful if somebody can help. Ample of thanks in advance. Excel file blueprint: Cells(2,3) Cells(2,4) Cells(2,5) Cells(2,6) Cells(2,7) Cells(2,8) p_qry_no p

VBA to find a specified cell value in specified range and select it

偶尔善良 提交于 2019-12-31 05:20:32
问题 I am having trouble creating a macro that will find a specified value in my active sheet within a range in my "Information" sheet. If the cell value us not found in the range then it will give me a message box stating "Value not Found" I have the following but it is not working: Sub testrot() Dim i As String Dim srchrng As Range Sheets(ActiveSheet.Name).Select i = Cells(2, 5) Sheets("Information").Select Set srchrng = Range("j8:j17").Find(what = i) If Not srchrng Is Nothing Then MsgBox "Not

Excel VBA Save Sheets to Multiple Folders with Unique Names

蹲街弑〆低调 提交于 2019-12-31 05:20:08
问题 Thank you for all of the input. The code below is a culmination of the input received. I have commented on the errors, which directly pertain to the overall desired result of saving into the folders defined in the array. Option Explicit Public EngName As String, TeamNum As Variant Public x As Integer Option Base 1 '### From David Zemens ### Function secfol(i As Long) secfol = Array("", _ "Section 1 Jobs Released Last Week (excludes NRT Jobs)", _ "Section 2 Jobs Created Last Week (excludes NRT

VBS Save File From Link

自闭症网瘾萝莉.ら 提交于 2019-12-31 05:18:04
问题 I wonder whether someone can help me please. I wanting to use this solution in a script I'm trying to put together, but I'm a little unsure about how to make a change which needs to be made. You'll see in the solution that the file type which is opened is a Excel and indeed it's saved as such. But I the files I'd like to open and save are a mixture of .docx and .dat (Used by Dragon software) files. Could someone possible tell me please is there a way by which I can amend the code so it opens

VBA Get File Name From Path and Store it to a Cell [duplicate]

故事扮演 提交于 2019-12-31 05:16:07
问题 This question already has answers here : How do you get just the filename rather than the entire file path of an open file? (5 answers) Closed 5 years ago . I'm working on some code that I would like to find the path of a selected file, extract the file name, and then write the file name to a cell on the sheet. Here's what I have so far: Private Sub CommandButton3_Click() Sheets("Raw Data").Unprotect Application.DisplayAlerts = False Sheets("Raw Data").Delete Sheets.Add After:=Worksheets(1)

Using multiple language (english, chinese, japanese) in VBA

走远了吗. 提交于 2019-12-31 05:07:10
问题 I need to be able to use strings of multiple languages (english, chinese and japanese) in VBA. Changing the region/locale setting of the computer only works if there is one language. Could someone help? Example code dim x as string dim y as string dim z as string x = "English text" y = "尊敬的" z = "こんにちは" 回答1: There's a simple alternative to ashleedawg's suggestion: Use bytearrays instead of strings to declare the strings. That way, the VBA IDE can store the data independent of locale settings.

Why is this PivotItem.Visible call throwing a TypeMismatch error?

孤街浪徒 提交于 2019-12-31 04:44:06
问题 This is baffling us. I have a standard pivot table with a report filter on it that allows multiple selection of items. I can get the selected items in the report filter with: Dim pi As PivotItem For Each pi In PivotTables("MyPivot").PivotFields("MyField").PivotItems If pi.Visible Then Debug.Print pi.Value End If Next Simple. My collegue has a standard pivot table with a report filter on it that allows multiple selection of items. He tries getting selected items in the report filter with the

Searching for files with dir - Multiple hits

空扰寡人 提交于 2019-12-31 04:30:11
问题 I have a macro that iterate through folders and use the "dir"-function to find out if a file exist in the active folder, and puts the filename in a cell. The problem is that it might be two or more files satisfies the search. Dir(subfolder & "\Kommunesvar*") How can I get both two results in a specified subfolder if there are two files starting with "Kommunesvar"? Dir returns the filename, but I want both. 回答1: How are you using DIR . The below code will give you all the files which start