Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
RDC RDC is offline
external usenet poster
 
Posts: 3
Default delete contents of cell

I have two questions, firstly I want to delete a cells value (it has a
numerical value in it) by typing the word "dead" into another cell.

Secondly, I have large spreadsheet with deals on, can I somehow run a macro
to remove all those deals with the "Dead" in the row to another spreadsheet?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default delete contents of cell

This is only the first part. Say we have data in column B. If we enter
"dead" in column A we want the adjacent cell in column B to be cleared. Put
this event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set A = Range("A:A")
If Intersect(t, A) Is Nothing Then Exit Sub
If UCase(t.Value) = "DEAD" Then
Application.EnableEvents = False
t.Offset(0, 1).Clear
Application.EnableEvents = True
End If
End Sub

Say we have data in column B and already have some "dead"s in column A and
we want to do some cleanup. Run this macro:

Sub oldData()
n = Cells(Rows.Count, 1).End(xlUp).Row
Application.EnableEvents = False
For i = 1 To n
If UCase(Cells(i, 1).Value) = "DEAD" Then
Cells(i, 2).Clear
End If
Next
End Sub

--
Gary''s Student - gsnu200828


"RDC" wrote:

I have two questions, firstly I want to delete a cells value (it has a
numerical value in it) by typing the word "dead" into another cell.

Secondly, I have large spreadsheet with deals on, can I somehow run a macro
to remove all those deals with the "Dead" in the row to another spreadsheet?

Thanks

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
How can I delete the contents of a cell without deleting the formu 6js59 Excel Discussion (Misc queries) 0 June 3rd 08 07:01 PM
Delete cell contents Rob[_4_] Excel Discussion (Misc queries) 7 April 10th 07 12:34 PM
copy paste delete cell contents Garry Excel Discussion (Misc queries) 0 March 27th 06 08:26 PM
Delete all contents of cell but one word Hayette Hasham Excel Discussion (Misc queries) 5 January 18th 06 08:20 AM
Delete row based on contents of cell AndyG Excel Discussion (Misc queries) 6 November 17th 05 10:08 PM


All times are GMT +1. The time now is 10:49 AM.

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"