Computer Science, asked by supriyadubey7012, 4 days ago

clearing content of a range A9:B10​

Answers

Answered by anushkasengupta786
3

Answer:

here is ur answer:-

Explanation:

have data in the range A9:G15, set in the table where A9:G9 contains the headers.

I am using a macro that clears some adjacent cells of adjacent columns in the range B10:G15 once $A$10 is cleared or changed.

The macro seems to only clear the adjacent cells in Range B10:G10, while leaving the data in the range B11:B15. This is because I am not clearing the cells in A11:A15 as I don't want the users to enter data in Range A11:A15.

Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False

If Not Intersect(Target, Range("$A10:A15")) Is Nothing Then

Target.Offset(0, 1).ClearContents

Target.Offset(0, 2).ClearContents

Target.Offset(0, 3).ClearContents

Target.Offset(0, 4).ClearContents

ElseIf Not Intersect(Target, Range("B10:B15")) Is Nothing Then

Target.Offset(0, 1).ClearContents

Target.Offset(0, 2).ClearContents

Target.Offset(0, 3).ClearContents

ElseIf Not Intersect(Target, Range("C10:C15")) Is Nothing Then

Target.Offset(0, 1).ClearContents

Target.Offset(0, 2).ClearContents

ElseIf Not Intersect(Target, Range("D10:D15")) Is Nothing Then

Target.Offset(0, 1).ClearContents

End If

End Sub

In an attempt to fix this, I entered this formula in the cells of A11:A15 IF($A$10="","", $A$10), and I set the font of A11:A15 to grey color and the fill to grey so the users won't see the repetition in these cells and so they know that they should not enter data in those cells.

However, it seems that the macro doesn't recognize the "" in A11:A15 (which is returned by the formula) as an act of clearing any of the cells in A11:A15.

Note that I need the macro to be applied to any new row inserted in the table later on.

I hope this will help you. ☺If it helps you plz say thanks and plz mark me as the brainliest.

Similar questions