Hi Guys,

I'm playing around with VBA to learn what certain functions do (while reading a book on the subject)

I write the code below but there are two problems:

1. The ElseIf vbCancel Then Exist Sub does not operate as expected, it does the same as the vbNo option. The same happens if you click Yes.
2. When you click OK on the second input box the macro gives a run-time error. It has to do with the Worksheets("Sheet1").Range("myrange").Offset(10, 10).Value = _
Worksheets("Sheet1").Range("myrange").Value statement.

I don't know what the problem is. Please help, I'm a newbie! My code is below.

Sub CopyCell()

Dim cell_range As String

cell_range = Application.InputBox("Enter cell number with absolute references", , , , , , , 2)

Msg = ("Are you sure the correct cell is " & cell_range & "?")

MsgBox Msg, vbYesNoCancel

If vbNo Then
        cell_range = Application.InputBox("Tye the correct cell reference and this time make sure", , , , , , , 2)
        Worksheets("Sheet1").Range("cell_range").Offset(10, 10).Value = _
        Worksheets("Sheet1").Range("cell_range").Value
    ElseIf vbCancel Then
        Exit Sub
    Else
        Worksheets("Sheet1").Range("cell_range").Offset(10, 10).Value = _
        Worksheets("Sheet1").Range("cell_range").Value
End If
        
End Sub
Thanks.
B