Hi I'm new to vba programming and I'm trying to make a very simple macro which swaps values
The macro calls a form which looks like this
Private Sub btnSubmit_Click() '\\ handles Submit button
Call SwapValues(txtCell1.Text, txtCell2.Text) '\\Calls SwapValues sub
End Sub
Sub SwapValues(cell1 As String, cell2 As String)
Dim temp As String '\\used as temp in swap
Dim strCell2 As String '\\to be inserted to cell1
Range(cell1).Select
temp = cell1.Value
Range(cell2).Select
strCell2 = cell2.Value
cell2.Value = temp
Range(cell1).Select
cell1.Value = strCell2
End Sub
But when I run it, after i put the values into my text boxes(txtCell1 and txtCell2) and hit submit, i get the Message: "Compile Error: Invalid Qualifier, can someone please help me figure out what I'm doing wrong
Bookmarks