excel-vba

Getting HTML Source with Excel-VBA

六月ゝ 毕业季﹏ 提交于 2020-02-05 15:50:15
问题 I would like to direct an excel VBA form to certain URLs, get the HTML source and store that resource in a string. Is this possible, and if so, how do I do it? 回答1: Just an addition to the above response. The question was how to get the HTML source which the stated answer does not actually provide. Compare the contents of oXMLHTTP.responseText with the source code in a browser for URL "http://finance.yahoo.com/q/op?s=T+Options". They do not match and even the returned values are different.

Getting HTML Source with Excel-VBA

拥有回忆 提交于 2020-02-05 15:49:03
问题 I would like to direct an excel VBA form to certain URLs, get the HTML source and store that resource in a string. Is this possible, and if so, how do I do it? 回答1: Just an addition to the above response. The question was how to get the HTML source which the stated answer does not actually provide. Compare the contents of oXMLHTTP.responseText with the source code in a browser for URL "http://finance.yahoo.com/q/op?s=T+Options". They do not match and even the returned values are different.

VBA - Compare Tables on 2 Sheets with Differences

拥有回忆 提交于 2020-02-05 13:58:07
问题 I am new to VBA and was looking for help in writing a sub or code that can compare the same column (B) of two tables on 2 different sheets and combine them into a single table on the first sheet. I have looked at ways to do it and am really confused about using ranges or unions as a solution. I want it to find items both missing from column b in sheet 2 (which will have a dynamic, but known name stored in a variable) and add that entire row to sheet 1 (named 'Dump' with an additional comment

Creating multiple worksheets or workbooks from one source worksheet

回眸只為那壹抹淺笑 提交于 2020-02-05 05:53:09
问题 I have a spreadsheet with over a thousand rows. The unique identifier is the vendor ID which is located in column B. The data covers from column A to column N. I want to parse this master spreadsheet and create new worksheets or better yet create a new file/workbook by each vendor ID. The spreadsheet does not contain headers. A vendor ID may just have one row or it can have 20 rows of data, 3 rows of data, etc. Lastly, I would like to convert the new file into .CSV format. When creating the

Excel VBA - Use an existing string in called sub

情到浓时终转凉″ 提交于 2020-02-05 05:20:26
问题 I'm pretty new to this so apologies in advance I'm half way through a userform in Excel and I'm trying to cut some fat off my code by using Call - I have 12 buttons that all do the same thing, the only difference is that each buttons sub is dependant on the buttons caption. My problem is that I can't figure out a way to use a String I've already declared in the Buttons Sub, then use it in the called Sub. I know you can do it, but my googling skills have failed me :( Please could someone show

VBA Office2010 Shapes.PasteSpecial fails

蹲街弑〆低调 提交于 2020-02-04 04:04:12
问题 I have a problem while migrating my VBA code from Office2003 to Office2010. I would like to copy the text of a cell (Excel) to Powerpoint. Office2003 generated a new textbox and the style of the text was the same as in Excel. Now my code fails with Office2010 and I get the following message: runtime error -2147188160 (80048240) Shapes.PasteSpecial : Invalid request. Clipboard is empty or contains data which may not be pasted here. The clipboard is definitly not empty. The code is the

how to convert yyyymm number string into end month date using vba?

坚强是说给别人听的谎言 提交于 2020-02-03 23:43:12
问题 Currently, in my Excel, there is a string of year and month written as yyyymm. Eg: 201706 Right now I would like to convert it into the end of month date in another worksheet. Eg: 20170630 The question now is, how do I tell Excel to auto create the day based on the month value in the string? I was planning on using if statements to declare each month based on the ending value at the back of the string. (ie: If 2017 06 , date = 20170630) But then I thought that won't work for February's leap

how to convert yyyymm number string into end month date using vba?

爷,独闯天下 提交于 2020-02-03 23:42:09
问题 Currently, in my Excel, there is a string of year and month written as yyyymm. Eg: 201706 Right now I would like to convert it into the end of month date in another worksheet. Eg: 20170630 The question now is, how do I tell Excel to auto create the day based on the month value in the string? I was planning on using if statements to declare each month based on the ending value at the back of the string. (ie: If 2017 06 , date = 20170630) But then I thought that won't work for February's leap

Copy a worksheet without copying the code

醉酒当歌 提交于 2020-02-03 06:40:13
问题 I can copy a worksheet by calling its .Copy method. Sheets("Example").Copy After:=Worksheets("Sheet3") However, this also copies any macros or event handlers associated with that worksheet. How do I copy the worksheet without copying any Visual Basic code? 回答1: After copying the sheet, you can reference it by name and then delete all of the lines from the code module: Sheets("Example").Copy After:=Sheets("Sheet3") ' Get the code/object name of the new sheet... Dim strObjectName As String

Delete worksheet if it exists and create a new one

给你一囗甜甜゛ 提交于 2020-02-03 04:51:28
问题 I want to look through my Excel worksheets and find a sheet with a certain name and delete that sheet if it is found. Afterwards I want to create a sheet after all existing sheets with that name. My code is as follows: For Each ws In Worksheets If ws.Name = "asdf" Then Application.DisplayAlerts = False Sheets("asdf").Delete Application.DisplayAlerts = True End End If Next Sheets.Add(After:=Sheets(Sheets.count)).Name = "asdf" However this doesn't do both of these actions in one run of the code