ws - a worksheet
ows - another worksheet
cell is a string = "G5"
i and c are respectivly row and columns
cell = ws.Cells(i, 1)
ows.Cells(cell).Value = ws.Cells(i, c)
Set ws = ThisWorkbook.Sheets("Sheet1") 'Replace with your sheet name
Set ows = ThisWorkbook.Sheets("Sheet2") 'Replace with your sheet name
cell = ws.Cells(i, 1)
ows.Range(cell).Value = ws.Cells(i, c)
Range需要一个字符串,如“A5”或“A5:B5”,其中as Cells需要两个数字,用逗号分隔
'Examples
Cells(1,2)
Range("A5")
Range("A5:B5")
Range(Cells(10,4), Cells(8,3)) 'Use Cells as args for a Range
1条答案
按热度按时间wvyml7n51#
Range需要一个字符串,如“A5”或“A5:B5”,其中as Cells需要两个数字,用逗号分隔
另一个区别是Cells将返回工作表的一个单元格或所有单元格。