0
Sub Clear_Table(ct)
    Range(ct).Select
    'Range(Selection, Selection.End(xlToRight)).Select
    'Range(Selection, Selection.End(xlDown)).Select
    Selection.ClearContents
    Range(ct).Select
End Sub

Sub rite()



Clear_Table ("E10")

Range("E10").Value = "dwsds"

End Sub

getting compile error: Argument not optional (only want to clear value in a cell not the entire range and put the value in that cell. please help)

Daulat Daga
  • 13
  • 2
  • 5
  • Agree with Vityata's point, but I cannot replicate your error. Perhaps you have other code. – SJR Aug 09 '17 at 10:20

1 Answers1

1

Here is something that can do the job:

Option Explicit

Sub Clear_Table(ct As Range)

    ct.ClearContents

End Sub

Sub rite()

    Clear_Table Range("E10")
    Range("E10").Value = "dwsds"

End Sub

Try to avoid Selection as much as you can. See more here - How to avoid using Select in Excel VBA

Vityata
  • 42,633
  • 8
  • 55
  • 100