excel-vba

how to find cells with “#VALUE!” in EXCEL 2010 VBA

ε祈祈猫儿з 提交于 2020-02-02 16:27:06
问题 I need to find the max value in a column by EXCEL 2012 VBA. Some cells have "#VALUE!". My code does not work. Sub find_max() Dim rng As Range Dim dblMax As Double dblMax = 0 Set rng = Range("A2:A11") For Each cell In rng If (cell.Value <> "#VALUE!") Then // error ! type mismatch If dblMax < CDbl(cell.Value) Then dblMax = CDbl(cell.Value) End If End If Next cell MsgBox dblMax End Sub I also need to print the cell location (mark it with a color) with the max value. Any help would be appreciated

Split the content of cells in a column using regex

末鹿安然 提交于 2020-02-02 16:24:09
问题 Here is the code that I had until now, which actually deletes everything in a cell but the numbers. This looked like this: Sub myTest() Dim myCel As Range Dim i As Integer i = 0 'copier le contenu de la colonne A dans la colonne B Columns("A:A").Select Selection.Copy Columns("B:B").Select ActiveSheet.Paste 'on supprime tout ce qui n'est pas un nombre With CreateObject("VBScript.Regexp") .Global = True .Pattern = "\D+" For Each myCel In Range("B1:B900") myCel.Value = .Replace(myCel.Value, "")

How to convert JSON data to xml data in excel macro or VB.Net

社会主义新天地 提交于 2020-02-02 16:16:35
问题 I am getting data in JSON format {"name":"ryan","age":1,"roll":2,"address":"aaa"},{"name":"ryan","age":1,"roll":2,"address":"aaa"},{"name":"ryan","age":1,"roll":2,"address":"aaa"},{"name":"ryan","age":1,"roll":2,"address":"aaa"}] How can it be converted into xml format. So that i can use it in populating my excel spreadsheet. Or is there any way to directly convert JSON data to excel in macro 回答1: Or is there any way to directly convert JSON data to excel in macro? Sometimes JSON text is very

How to click on a hyperlink on a web page using vba excel?

五迷三道 提交于 2020-02-02 15:37:26
问题 I am new to excel vba programing. I have been trying to click on a hyperlink on a web page using excel vba from almost 3 days now. Please help me out. Since I am new to this I might have made a lot of blunders. Pardon me for that. The scenario is : A particular web page has a table with first column as an icon, second column is a hyperlink and a few more columns with some description about the hyperlink. Now, I want to click on the hyperlink in the first row (second column). When we hover

Check with VBA if an element exists on the page

会有一股神秘感。 提交于 2020-02-02 15:15:05
问题 I have 15,000 products and I need to know if they're X, Y or Z. The code below checks on amazon to see if a product is a type of XYZ. God help me, it actually works. The only exception is when it searches a product no longer sold by Amazon. Then the element ID that I'm looking for which contains the product description that I'm searching doesn't exist on the page, and the code breaks on line text = document.getelementbyID("result_0").innertext with the error "Object variable or With block

Check with VBA if an element exists on the page

青春壹個敷衍的年華 提交于 2020-02-02 15:12:25
问题 I have 15,000 products and I need to know if they're X, Y or Z. The code below checks on amazon to see if a product is a type of XYZ. God help me, it actually works. The only exception is when it searches a product no longer sold by Amazon. Then the element ID that I'm looking for which contains the product description that I'm searching doesn't exist on the page, and the code breaks on line text = document.getelementbyID("result_0").innertext with the error "Object variable or With block

Check with VBA if an element exists on the page

天涯浪子 提交于 2020-02-02 15:10:31
问题 I have 15,000 products and I need to know if they're X, Y or Z. The code below checks on amazon to see if a product is a type of XYZ. God help me, it actually works. The only exception is when it searches a product no longer sold by Amazon. Then the element ID that I'm looking for which contains the product description that I'm searching doesn't exist on the page, and the code breaks on line text = document.getelementbyID("result_0").innertext with the error "Object variable or With block

How to append text to comment in Excel VBA?

不打扰是莪最后的温柔 提交于 2020-02-02 10:56:16
问题 I have a VBA script that appends text to any cell's comment, however it removes all comment formatting. My current code is as simple as c.Comment.text "something to append" & " " & c.Comment.text Is it possible to do this job, but without losing all comment's formatting. 回答1: As documented, the Text method has three parameters. Use all three to keep existing text: c.Comment.Text "something to append ", 1, False 回答2: Be very careful when using the Characters functions because there are ancient

Import multiple CSV files from Internet into Excel

陌路散爱 提交于 2020-02-02 10:20:00
问题 I use this code to retrieve historical stock prices for about 40 tickers. I found it here http://www.mathfinance.cn/download-multiple-stock-quotes-from-yahoo-finance It downloads about half of the symbols before a Run-time Error '1004' pops up. "Unable to open http://table.finance.yahoo.com/table.csv?s=Tickersymbol&a=11&b=21&c=1998 The internet site reports that the item you requested cannot be found (HTTP/1.0 404) Can I change the code so this error won't happen? The code is below Sub Get

Create new powerpoint presentation from powerpoint template using VBA in Excel

白昼怎懂夜的黑 提交于 2020-02-02 09:47:53
问题 I have an excel macro that opens a powerpoint file from a specified location. The powerpoint file is a template but i need the macro to create a new presentation based on the template design rather than open the template itself. My code will open the template rather than a new presentation based on that template and is as follows: Sub Open_PowerPoint_Presentation() 'Opens a PowerPoint Document from Excel Dim objPPT As Object Set objPPT = CreateObject("PowerPoint.Application") objPPT.Visible =