run-time error '50290' Method 'Select' of object 'range' failed

%3CLINGO-SUB%20id%3D%22lingo-sub-2663296%22%20slang%3D%22en-US%22%3Erun-time%20error%20'50290'%20Method%20'Select'%20of%20object%20'range'%20failed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2663296%22%20slang%3D%22en-US%22%3E%3CP%3EGood%20day%20its%20my%20first%20macro%20and%20vba%20and%20spent%20a%20whole%20night%20still%20keep%20getting%20this%20error%20when%20i%20run%20it%26nbsp%3B%3C%2FP%3E%3CP%3ESub%20Button1_Click()%3C%2FP%3E%3CP%3E'%3C%2FP%3E%3CP%3E'%3C%2FP%3E%3CP%3EButton1_Click%20Macro%3C%2FP%3E%3CP%3E'%3C%2FP%3E%3CP%3E'%3C%2FP%3E%3CP%3ERange(%22A5%22).Select%3C%2FP%3E%3CP%3ESelection.ClearContents%3C%2FP%3E%3CP%3EEnd%20Sub%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2663296%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2664170%22%20slang%3D%22en-US%22%3ERe%3A%20run-time%20error%20'50290'%20Method%20'Select'%20of%20object%20'range'%20failed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2664170%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1131901%22%20target%3D%22_blank%22%3E%40darry88888888%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETry%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-visual-basic%22%3E%3CCODE%3ESub%20Button1_Click()%0A'%0A'Button1_Click%20Macro%0A'%0A%20%20%20%20Range(%22A5%22).ClearContents%0AEnd%20Sub%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

Good day its my first macro and vba and spent a whole night still keep getting this error when i run it 

Sub Button1_Click()

'

'

Button1_Click Macro

'

'

Range("A5").Select

Selection.ClearContents

End Sub

1 Reply

@darry88888888 

Try

 

Sub Button1_Click()
'
'Button1_Click Macro
'
    Range("A5").ClearContents
End Sub