Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Delete Activecell if it is not numeric

HI,

How do I delete the Activecell if it is not numeric?

Thanks in Advance

FIRSTROUNDKO

--
Message posted via http://www.officekb.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Delete Activecell if it is not numeric

Hi,
You don't give too much to go on and in fact what you intend to do sounds
very high risk to me, you could inadvertantly end up deleting data you might
not want to. Right click your sheet tab, view code and paste this in. Because
it is so risky I've limited the functionality to a single cell A1. The
commented out line shows you how to use this on a range of cells.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
'If Not Intersect(Target, Range("A1:A10")) Is Nothing Then
If Target.Address = "$A$1" Then
If Not IsNumeric(Target.Value) Then Target.ClearContents
End If
End Sub

Mike

"FIRSTROUNDKO via OfficeKB.com" wrote:

HI,

How do I delete the Activecell if it is not numeric?

Thanks in Advance

FIRSTROUNDKO

--
Message posted via http://www.officekb.com


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Delete Activecell if it is not numeric

With ActiveCell
If Application.IsNumber(.Value) Then
'skip it
Else
.Delete shift:=xlShiftUp 'or xlshifttoleft
'or
'.EntireRow.Delete
'or
'.ClearContents
'or
'.Clear
End If
End With

I'm not sure what delete means in your case.


"FIRSTROUNDKO via OfficeKB.com" wrote:

HI,

How do I delete the Activecell if it is not numeric?

Thanks in Advance

FIRSTROUNDKO

--
Message posted via http://www.officekb.com


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Delete Activecell if it is not numeric

Dave,

Thanks for a nice easy code

Dave Peterson wrote:
With ActiveCell
If Application.IsNumber(.Value) Then
'skip it
Else
.Delete shift:=xlShiftUp 'or xlshifttoleft
'or
'.EntireRow.Delete
'or
'.ClearContents
'or
'.Clear
End If
End With



I'm not sure what delete means in your case.


HI,

[quoted text clipped - 6 lines]
--
Message posted via http://www.officekb.com



--
Message posted via http://www.officekb.com

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
TO DELETE ONLY NUMERIC VALUES IN A CHARACTER AND NUMERIC CELL IN ramesh k. goyal - abohar[_2_] Excel Discussion (Misc queries) 1 October 28th 09 06:50 AM
Need Help with ActiveCell.EntireRow.Delete Ayo Excel Discussion (Misc queries) 4 July 20th 08 11:07 AM
Need Help with ActiveCell.EntireRow.Delete Ayo Excel Discussion (Misc queries) 8 July 19th 08 04:45 PM
Delete first character in ActiveCell Andy Excel Programming 8 November 17th 04 03:40 PM
Delete the row where the activecell is located with VBA Tim Zych[_2_] Excel Programming 0 July 19th 03 03:57 AM


All times are GMT +1. The time now is 02: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"