I want to put the cell's address/name as string rather than column, row.
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)
___________|||||||___________
That code brings out an error.
Cheers, Vihar
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 expects a string, such as "A5" or "A5:B5", where as Cells expects two numbers separated by a comma
'Examples
Cells(1,2)
Range("A5")
Range("A5:B5")
Range(Cells(10,4), Cells(8,3)) 'Use Cells as args for a Range
One other difference is Cells will return either one cell or all cells of a worksheet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With