I'm trying to copy values from a range based on a user defined sheet and cell reference. For example in A1 I have defined the Sheet Name to be copied to, B1 is the cell reference to be copied to & C1 is the value to be copied. The below code completes this for row 1 only, but I require to loop this for all rows in a defined range (i.e. named range A1:C200) or until the row is blank.
Preferably I would have an option to copy the cell value in the range (e.g. C1 as above) or the formula that exists in the range.
Sub CopyValues()
Dim SheetName
Dim CellRef
Dim Value
With ThisWorkbook.Sheets("Sheet1")
SheetName = Range("A1").Value
CellRef = Range("B1").Value
Value = Range("C1").Value
End With
ThisWorkbook.Sheets(SheetName).Range(CellRef).Value = Value
End Sub