Hi, I am very new to Excel Code and I have created some code based on a macro (seen below). This works fine, however I want to change the code so that:
1 - A user is prompted to enter a cell reference to copy from
2 - Once the user has entered a valid copy from cell E.G. F4 the code takes that value and places a D in front of the 4. So the user only has to enter one cell reference.
Basically I am copying and pasting from one row at a time. So in this spreadsheet a user is always going to be copying from the F column and always pasting to the D column it's just the row that is changing.
Sub CopyPasteValues()
' CopyPasteValues Macro
'
On Error GoTo errorHandler
Dim vfromcell As String
Dim vtocell As String
vfromcell = InputBox("Enter Cell to copy from: ")
vtocell = InputBox("Enter Cell to paste to: ")
Range(vfromcell).Select
Selection.Copy
Range(vtocell).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Exit Sub
errorHandler:
MsgBox ("Make sure a valid Cell is entered e.g. D4")
End Sub
Thanks for your time.
Sam
Bookmarks