David Quetglas
David Quetglas

Reputation: 87

VBA code for deleting

I'm trying to write inside a button in a userform to clear the cell if it is less than 1%

Range("G9:G28").Select
Selection.ClearContents if range("g9:g28) < 0

This is probably very wrong

Upvotes: 1

Views: 55

Answers (1)

GSerg
GSerg

Reputation: 78134

dim c as range

for each c in activesheet.range("G9:G28")
  if c.value < 0 then c.clearcontents
next

Upvotes: 2

Related Questions