[英]How to assign cell value to a variable?
我正在嘗試獲取一些單元格值並將其分配給變量。
Vars'result'和'result2'是兩個Long值,其中包含我要查找的行和列。 我已經檢查了並且表上的數字匹配,但是當我運行代碼時它說
錯誤1004“應用程序定義的錯誤或對象定義的錯誤”。
這是我得到的:
For row = 1 To countRows
brand = Sheets("2017").Cells(row, 1)
If InStr(strSaida, brand) Then
result2 = row
End If
Next row
For col = 2 To countCol
mes = Sheets("2017").Cells(2, col)
If InStr(strProcMes, mes) Then
result = col
End If
Next col
Dim cellValor As Long
cellValor = Sheets("2017").Range(Cells(result2, result)).Value
這是問題線
cellValor = Sheets("2017").Range(Cells(result2, result)).Value
它應該是
cellValor = Sheets("2017").Cells(result2, result).Value
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.