Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA clear contents of cell 1

Status
Not open for further replies.

Benaway

Technical User
Feb 14, 2017
12
0
0
US
Have a spreadsheet with dropdown menu for rows 1 through 10, which include the choice's of "in, out, remote, etc.
The dropdown menu will be in A2. B2 & C2 are open for typing in locations, etc. What I would like to do is when the choice in the dropdown menu in A2 is either In or OUT, then cells B3 and C4 would automatically be cleared of contents. All other dropdown picks would do nothing in B3 and C4. This should also work for each row 1 thru 10 separately. Will be using excel 2010. Attached is file.
 
Hi,

Where's the workbook?

VBA questions are best addressed in forum707.

In this case Event processing is required, on the sheet code page (right-click the Sheet Tab > View Code

On the Sheet Code Page there are two Drop Downs just above the code window. Select Worksheet in the Object Drop Down and then select Change in the Procedure Drop Down.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'[b]when a change occurs in column A   [/b]
    If Not Intersect(Target, Cells(1, "A").EntireColumn) Is Nothing Then
'[b]then the values in that row in columns B & C are cleared     [/b]
        Intersect(Target.EntireRow, Range("B:C")).ClearContents
    End If
End Sub

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top