how to replace the single quotation with // in excel macros using VBA
<p>I have a string in sheet 2, and the string starts with " ' " single quotation, I want to replace the  single quotation with //, I have written the following code through excel macro, however the output starts with ' as well as // and then the string</p>

<pre><code>Sub Conversion()

Dim qtpval, selval
qtpval = "'"
selval = "//"
'qtpval = Sheets("Variables").Range("A2")
'qtpval = Left(qtpval, Len(qtpval) - 1)
'MsgBox qtpval
'selval = Sheets("Variables").Range("B2")
'MsgBox selval

MoveCode qtpval, selval

'readvariables

End Sub

Function MoveCode(qtpval, selval)

Dim lRowCount As Long

Application.ActiveSheet.UsedRange
lRowCount = Worksheets("QTP Code").UsedRange.Rows.Count
'MsgBox lRowCount

Dim i
Dim j
j = 1

For i = 1 To lRowCount

tempvar = Sheets("QTP Code").Range("A" &amp; i)
chngval = Replace(tempvar, qtpval, selval)
'If InStr(tempvar, "'") Then
'MsgBox "pass"

'Sheets(3).Range("A" &amp; j).Value = "//" &amp; tempvar
Sheets(3).Range("A" &amp; j).Value = chngval
j = j + 1
'End If

Next i

End Function

'Function readvariables()

'Dim varRowCount As Long

'Application.ActiveSheet.UsedRange
'varRowCount = Worksheets("Variables").UsedRange.Rows.Count
'MsgBox varRowCount

'End Function
</code></pre>