Ok, I have been working on this code for weeks off and on but I'm finally stumped. I have figured everything else out but why this won't work. This code worked perfectly when all you had to do was type the names of the cells. But now, my boss wants you to use the mouse to select them which should be easy. This is what I have so far.
Sub SwapButton()
'
' SwapButton Macro
cel1 = Application.InputBox("Please select the information of the first student.", , , , , , 8)
cel2 = Application.InputBox("Please select the information of the second student.", , , , , , 8)
c1 = Range(cel1).Select
c2 = Range(cel2).Select
Range(cel1).Value = c2
Range(cel2).Value = c1
End Sub
Every time I try and run the code with the button it is assigned to I get a (Run-time error '1004': Method 'Range of object '_Global'failed) on the 3rd line (c1 = Range(cel1).Select) I need it too stop doing that. Any help you guys can offer would be great, there is ice cream at stake. I need this code to operate just like it is because of formatting and such in the whole workbook so I'm trying to avoid a new code. Just the fix to this one if at all possible. Thanks for the help guys.
Sub SwapButton()
'
' SwapButton Macro
cel1 = Application.InputBox("Please select the information of the first student.", , , , , , 8)
cel2 = Application.InputBox("Please select the information of the second student.", , , , , , 8)
c1 = Range(cel1).Select
c2 = Range(cel2).Select
Range(cel1).Value = c2
Range(cel2).Value = c1
End Sub
Every time I try and run the code with the button it is assigned to I get a (Run-time error '1004': Method 'Range of object '_Global'failed) on the 3rd line (c1 = Range(cel1).Select) I need it too stop doing that. Any help you guys can offer would be great, there is ice cream at stake. I need this code to operate just like it is because of formatting and such in the whole workbook so I'm trying to avoid a new code. Just the fix to this one if at all possible. Thanks for the help guys.