作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我从 Stackover Topic 来到这里做更快的宏。我得到了答案,但这段代码不起作用,我问你,(我试图修复)
Sub Faster_Method()
Dim objIE As InternetExplorer
Dim Prc1 As String
Set objIE = New InternetExplorer
Dim Search_Terms() As Variant
Dim CopiedData() As Variant
objIE.Visible = True
Search_Terms() = ActiveSheet.Range("A1:A121").Value
ReDim CopiedData(1 To UBound(Search_Terms) + 1)
For a = 1 To UBound(Search_Terms) + 1
objIE.navigate "https://opskins.com/?loc=shop_search&app=578080_2&sort=lh&search_item=" & Search_Terms(a)
Do: DoEvents: Loop Until objIE.readyState = 4
Prc1 = objIE.document.getElementsByClassName("item-amount")(0).innerText
CopiedData(a) = Prc1
Next
ActiveSheet.Range(Cells(1, 2), Cells(UBound(CopiedData), 2)).Value = CopiedData
objIE.Quit
End Sub
run time error '9' subscript out of range
调试是:
objIE.navigate "https://opskins.com/?loc=shop_search&app=578080_2&sort=lh&search_item=" & Search_Terms(a)
Sub Faster_Method()
Dim objIE As InternetExplorer
Dim Prc1 As String
Set objIE = New InternetExplorer
Dim Search_Terms() As Variant
Dim CopiedData() As Variant
Dim y As Integer
objIE.Visible = True
Search_Terms = Application.Transpose(ActiveSheet.Range("A1:A121").Value)
ReDim CopiedData(LBound(Search_Terms) To UBound(Search_Terms))
y = 1
For a = LBound(Search_Terms) To UBound(Search_Terms)
objIE.navigate "https://opskins.com/?loc=shop_search&app=578080_2&sort=lh&search_item=" & Search_Terms(a)
Do: DoEvents: Loop Until objIE.readyState = 4
Prc1 = objIE.document.getElementsByClassName("item-amount")(0).innerText
Sheets("Sheet1").Range("B" & y).Value = Prc1
y = y + 1
Next
ActiveSheet.Range(Cells(1, 2), Cells(UBound(CopiedData), 2)) = Application.Transpose(CopiedData)
objIE.Quit
End Sub
最佳答案
有几个问题。
Search_Terms() = ActiveSheet.Range("A1:A121").Value
debug.print lbound(Search_Terms, 1) & " to " & ubound(Search_Terms, 1)
debug.print lbound(Search_Terms, 2) & " to " & ubound(Search_Terms, 2)
ReDim CopiedData(1 To UBound(Search_Terms) + 1)
For a = 1 To UBound(Search_Terms) + 1
objIE.navigate "https://opskins.com/?loc=shop_search&app=578080_2&sort=lh&search_item=" & Search_Terms(a)
Search_Terms = application.transpose(ActiveSheet.Range("A1:A121").Value)
ReDim CopiedData(LBound(Search_Terms) To UBound(Search_Terms))
For a = LBound(Search_Terms) To UBound(Search_Terms)
ActiveSheet.Range(Cells(1, 2), Cells(UBound(CopiedData), 2)) = application.transpose(CopiedData)
关于vba - Excel VBA 数组循环故障排除 : Using Redim and UBound, 一维和二维数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49309956/
我正在按照 PCL 文档的教程计算 2D 凸包 see here . 我有一片云和一些指数,将它们投影到具有给定系数的平面上,然后计算凸包。这是代码: PointCloud::Ptr tmpInlie
我想使用模拟退火在某个预定义的区间内找到单变量多项式函数的局部最小值。我也想尝试找到二次函数的全局最小值。 像这样的无导数算法不是解决问题的最佳方法,因此仅供学习。 虽然算法本身非常简单,但我不确定如
我正在寻找任意值的 2 维和 3 维索引的快捷方式,我知道这适用于给定数组 a[] #define a(i,j,k) a[(i)*span*span+(j)*span+(k)] #define b(i
我有一个形状为 [12, 8, 5, 5] 的 numpy 数组。我想修改每个元素的第 3 维和第 4 维的值。 例如 import numpy as np x = np.zeros((12, 80,
我是一名优秀的程序员,十分优秀!