Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Changing Values In A Cell

Is there an easy way to delete the contents of a cell when that cell is not null and not greater than 0?
if the cell is a number greater than 0, I want it to remain the same.
If it is anything but a number greater than 0, I want to make it null.

Thanks in advance.
--
RAYMOND KELLY
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Changing Values In A Cell

Raymond,

For cell A1:

If Not (IsNumeric(Range("A1").Value) And (Range("A1").Value 0)) Then
Range("A1").ClearContents

As a Sub:

Sub myCellCheck(inCell As Range)
If Not (IsNumeric(inCell.Value) And (inCell.Value 0)) Then
inCell.ClearContents
End Sub

Called like:
Sub test()
myCellCheck Range("A1")
End Sub

HTH,
Bernie
MS Excel MVP

"RAYMOND KELLY" wrote in message
...
Is there an easy way to delete the contents of a cell when that cell is not
null and not greater than 0?
if the cell is a number greater than 0, I want it to remain the same.
If it is anything but a number greater than 0, I want to make it null.

Thanks in advance.
--
RAYMOND KELLY


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Changing Values In A Cell

Bernie,

Thank you.

Will this work when it is more than one cell?
I need to run the code once for all cells in the range A1..C100.

--
RAYMOND KELLY


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Raymond,

For cell A1:

If Not (IsNumeric(Range("A1").Value) And (Range("A1").Value 0)) Then
Range("A1").ClearContents

As a Sub:

Sub myCellCheck(inCell As Range)
If Not (IsNumeric(inCell.Value) And (inCell.Value 0)) Then
inCell.ClearContents
End Sub

Called like:
Sub test()
myCellCheck Range("A1")
End Sub

HTH,
Bernie
MS Excel MVP

"RAYMOND KELLY" wrote in message
...
Is there an easy way to delete the contents of a cell when that cell is

not
null and not greater than 0?
if the cell is a number greater than 0, I want it to remain the same.
If it is anything but a number greater than 0, I want to make it null.

Thanks in advance.
--
RAYMOND KELLY




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Changing Values In A Cell

Raymond,

Dim inCell As Range

For Each inCell In Range("A1:C100")
If Not (IsNumeric(inCell.Value) And (inCell.Value 0)) Then
inCell.ClearContents
Next inCell

HTH,
Bernie
MS Excel MVP

"RAYMOND KELLY" wrote in message
...
Bernie,

Thank you.

Will this work when it is more than one cell?
I need to run the code once for all cells in the range A1..C100.

--
RAYMOND KELLY


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Raymond,

For cell A1:

If Not (IsNumeric(Range("A1").Value) And (Range("A1").Value 0)) Then
Range("A1").ClearContents

As a Sub:

Sub myCellCheck(inCell As Range)
If Not (IsNumeric(inCell.Value) And (inCell.Value 0)) Then
inCell.ClearContents
End Sub

Called like:
Sub test()
myCellCheck Range("A1")
End Sub

HTH,
Bernie
MS Excel MVP

"RAYMOND KELLY" wrote in message
...
Is there an easy way to delete the contents of a cell when that cell is

not
null and not greater than 0?
if the cell is a number greater than 0, I want it to remain the same.
If it is anything but a number greater than 0, I want to make it null.

Thanks in advance.
--
RAYMOND KELLY






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Changing Values In A Cell

Raymond,

That code line- wrapped at just the wrong place...Here's one that will work
with the wrapping.

Dim inCell As Range

For Each inCell In Range("A1:C100")
If Not (IsNumeric(inCell.Value) And (inCell.Value 0)) Then
inCell.ClearContents
End If
Next inCell


HTH,
Bernie
MS Excel MVP

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Raymond,

Dim inCell As Range

For Each inCell In Range("A1:C100")
If Not (IsNumeric(inCell.Value) And (inCell.Value 0)) Then
inCell.ClearContents
Next inCell

HTH,
Bernie
MS Excel MVP

"RAYMOND KELLY" wrote in message
...
Bernie,

Thank you.

Will this work when it is more than one cell?
I need to run the code once for all cells in the range A1..C100.

--
RAYMOND KELLY


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Raymond,

For cell A1:

If Not (IsNumeric(Range("A1").Value) And (Range("A1").Value 0)) Then
Range("A1").ClearContents

As a Sub:

Sub myCellCheck(inCell As Range)
If Not (IsNumeric(inCell.Value) And (inCell.Value 0)) Then
inCell.ClearContents
End Sub

Called like:
Sub test()
myCellCheck Range("A1")
End Sub

HTH,
Bernie
MS Excel MVP

"RAYMOND KELLY" wrote in message
...
Is there an easy way to delete the contents of a cell when that cell

is
not
null and not greater than 0?
if the cell is a number greater than 0, I want it to remain the same.
If it is anything but a number greater than 0, I want to make it null.

Thanks in advance.
--
RAYMOND KELLY










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Changing Values In A Cell

Bernie,

I added the End If in the code from the prior e-mail and it worked like a
charm.

Thanks for your help.
Raymond

--
RAYMOND KELLY
"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Raymond,

That code line- wrapped at just the wrong place...Here's one that will

work
with the wrapping.

Dim inCell As Range

For Each inCell In Range("A1:C100")
If Not (IsNumeric(inCell.Value) And (inCell.Value 0)) Then
inCell.ClearContents
End If
Next inCell


HTH,
Bernie
MS Excel MVP

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Raymond,

Dim inCell As Range

For Each inCell In Range("A1:C100")
If Not (IsNumeric(inCell.Value) And (inCell.Value 0)) Then
inCell.ClearContents
Next inCell

HTH,
Bernie
MS Excel MVP

"RAYMOND KELLY" wrote in message
...
Bernie,

Thank you.

Will this work when it is more than one cell?
I need to run the code once for all cells in the range A1..C100.

--
RAYMOND KELLY


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Raymond,

For cell A1:

If Not (IsNumeric(Range("A1").Value) And (Range("A1").Value 0))

Then
Range("A1").ClearContents

As a Sub:

Sub myCellCheck(inCell As Range)
If Not (IsNumeric(inCell.Value) And (inCell.Value 0)) Then
inCell.ClearContents
End Sub

Called like:
Sub test()
myCellCheck Range("A1")
End Sub

HTH,
Bernie
MS Excel MVP

"RAYMOND KELLY" wrote in message
...
Is there an easy way to delete the contents of a cell when that cell

is
not
null and not greater than 0?
if the cell is a number greater than 0, I want it to remain the

same.
If it is anything but a number greater than 0, I want to make it

null.

Thanks in advance.
--
RAYMOND KELLY










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
Need to store changing values from one cell Emmie Excel Discussion (Misc queries) 5 September 17th 06 08:10 PM
changing cell values jamie&slings Excel Discussion (Misc queries) 1 May 3rd 06 01:29 AM
Changing values in a row based on a cell in the row. Casey Excel Discussion (Misc queries) 2 September 14th 05 03:23 PM
Changing cell colors based on values Jon Willits Excel Programming 3 February 29th 04 08:06 PM
Help Evaluating Cell Values and Changing Colors ChrisG[_2_] Excel Programming 1 July 14th 03 08:52 PM


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