Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Clear Contents Help

I'd like some help with clearing contents using vba.

If cell D18="Combo" (selected from a Data Validation List), clear the
contents of cells D19, D20, D21, D22 & D26.

If cell D18="One" (selected from a Data Validation List), clear the
contents of cells D23, D24, D26, D27, D28 & D29.

Much thanks in advance!

-Mike

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Clear Contents Help

You can use the change event to do this

Place the code in the Sheet module

Right click on a sheet tab and choose view code
Paste the code there
Alt-Q to go back to Excel

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("D18"), Target) Is Nothing Then
If Target.Value = "Combo" Then Range("D19, D20, D21, D22:D26").ClearContents
If Target.Value = "One" Then Range("D23, D24, D26, D27, D28:D29").ClearContents
End If
End Sub


--
Regards Ron De Bruin
http://www.rondebruin.nl



"michael" wrote in message oups.com...
I'd like some help with clearing contents using vba.

If cell D18="Combo" (selected from a Data Validation List), clear the
contents of cells D19, D20, D21, D22 & D26.

If cell D18="One" (selected from a Data Validation List), clear the
contents of cells D23, D24, D26, D27, D28 & D29.

Much thanks in advance!

-Mike



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Clear Contents Help

Sub ClearData
If Range("D18").Value = "Combo" then
Range("D19:D22").ClearContents
Range("D26").ClearContents
elseif Range("D18").value = "One" then
Range("D23:D24").ClearContents
Range("D26:D29").ClearContents
end if
End Sub

HTH

Die_Another_Day

michael wrote:
I'd like some help with clearing contents using vba.

If cell D18="Combo" (selected from a Data Validation List), clear the
contents of cells D19, D20, D21, D22 & D26.

If cell D18="One" (selected from a Data Validation List), clear the
contents of cells D23, D24, D26, D27, D28 & D29.

Much thanks in advance!

-Mike


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Clear Contents Help

Thank you!

michael wrote:
I'd like some help with clearing contents using vba.

If cell D18="Combo" (selected from a Data Validation List), clear the
contents of cells D19, D20, D21, D22 & D26.

If cell D18="One" (selected from a Data Validation List), clear the
contents of cells D23, D24, D26, D27, D28 & D29.

Much thanks in advance!

-Mike


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clear Contents gibbylinks Setting up and Configuration of Excel 5 October 12th 09 05:04 PM
Clear Contents Secret Squirrel Excel Discussion (Misc queries) 1 February 3rd 09 12:37 AM
vb to clear cell contents RichT New Users to Excel 6 June 27th 05 08:26 AM
Clear contents if x is not in the row Mighvik Excel Programming 1 October 5th 04 08:14 PM
Fastest way to clear contents Steph[_3_] Excel Programming 3 June 11th 04 07:05 AM


All times are GMT +1. The time now is 12:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"