I'm very new to VBA. I recorded a simple macro to copy information from a merged cell on one sheet and special paste it to a cell on a different sheet. The macro works fine, but when I put the code into a command button it gives me this error message: 'Run-time error '1004': Select method of range class failed'.
Here is the code:
Private Sub CommandButton2_Click()
Sheets("Form").Select
Range("D91:E91").Select
Selection.Copy
Sheets("NMAD _Setup_Info").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
Here is the code:
Private Sub CommandButton2_Click()
Sheets("Form").Select
Range("D91:E91").Select
Selection.Copy
Sheets("NMAD _Setup_Info").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub