在过去的几周里,当我学习 excel vb 时,我一直在不断地搜索堆栈溢出,但最后我被难住了。
我需要使用 x 位置的变量和 y 位置的变量来激活单元格。
xval 是整数 yval 是字符串
我正在尝试使用匹配功能来做到这一点,但没有运气。
这是我尝试过的。
Sheets("Attributes").Select 'this is the sheet with the raw data
Range("C2").Activate
Dim xval As String 'this is the row I'm looking for
Dim yval As Integer 'this is the colum I'm looking for
Dim value As String 'when I find the exact right cell on the next sheet this is the value that needs to go in it.
' start loop here
xval = ActiveCell.Offset(0, -2) 'populate variables
yval = ActiveCell
value = ActiveCell.Offset(0, 2)
Sheets("output").Select 'switch to output sheet
Range("A1").Activate
Cells(WorksheetFunction.Match(xval, "A:A", 0), WorksheetFunction.Match(yval, "A1:A500", 0)).Activate 'this line doesn't work
ActiveCell = value
'end loop when data runs out using is empty function