help with this code

  • Thread starter Thread starter VBA Noob
  • Start date Start date
V

VBA Noob

Looking to see if range contains a entry then clear the area calle
Clear

Any ideas greatfully received
Sub Macro7()

If Range("Clear_Area").Value <> "-" Then
Range("Clear").ClearContents
End If
End Sub

VBA noo
 
Hi VBA

Would this help

Sub keepdash()
Dim Cell As Range
Dim R As Range
Set R = ActiveSheet.UsedRange
'SearchChar = "-"
For Each Cell In R
valeur = Cell.Value
MyPos = InStr(1, valeur, "-")
If MyPos = 0 Then
Cell.Clear
End If
Next
End Su
 
Tried it on sheet and clear a lot of my data.

Must be a easier way to select A5 to L9 to check if there is text apart
from "-" which are in A5 to A9

Thanks in advance

VBA noob
 
Back
Top