PC Review


Reply
Thread Tools Rate Thread

Clearing a Cell Value

 
 
bumper338
Guest
Posts: n/a
 
      5th Mar 2008
I have done something like this before in vba, but when I try it now it is
not working. Here is what I want to do, if a value of cell c1 is < 0.01,
then I want the the value of cell d1 = "".

Here is what I used before:

If Cells(13, "E").Value = "" And Cells(13, "G").Value = "" Then
Range("P13:T13").Value = ""

I realize that the cells here where equal to null, but I thought if the I
used > or < that I would get the same result.

Here is what I am trying to use now:
If Cells(28, "P").Value < 43 Then
Range("Q29:Q30").Value = ""

Any suggestions?

Thanks in advance
 
Reply With Quote
 
 
 
 
donwb
Guest
Posts: n/a
 
      6th Mar 2008
You refer to the cell whose value you are testing to be less than 43
as <<Cells(28, "P")>>
Is the location reference meant to be in Row / Column format ie R1C1??
If so row 28, column E would be <<Cells(28,5)>>
If a range, then <<Range("E28")>>
Your <<Range("Q29:Q30")>> should be OK.
Hope this helps
donwb

"bumper338" <(E-Mail Removed)> wrote in message
news:E004DD7E-1314-4D9B-9708-(E-Mail Removed)...
>I have done something like this before in vba, but when I try it now it is
> not working. Here is what I want to do, if a value of cell c1 is < 0.01,
> then I want the the value of cell d1 = "".
>
> Here is what I used before:
>
> If Cells(13, "E").Value = "" And Cells(13, "G").Value = "" Then
> Range("P13:T13").Value = ""
>
> I realize that the cells here where equal to null, but I thought if the I
> used > or < that I would get the same result.
>
> Here is what I am trying to use now:
> If Cells(28, "P").Value < 43 Then
> Range("Q29:Q30").Value = ""
>
> Any suggestions?
>
> Thanks in advance



 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      6th Mar 2008
You can also use ClearContents
If Cells(13, "E").Value = "" And Cells(13, "G").Value = "" Then
Range("P13:T13").ClearContents
End If

What are you having a problem with? There does not appear to be a problem
with the code you posted.

"bumper338" wrote:

> I have done something like this before in vba, but when I try it now it is
> not working. Here is what I want to do, if a value of cell c1 is < 0.01,
> then I want the the value of cell d1 = "".
>
> Here is what I used before:
>
> If Cells(13, "E").Value = "" And Cells(13, "G").Value = "" Then
> Range("P13:T13").Value = ""
>
> I realize that the cells here where equal to null, but I thought if the I
> used > or < that I would get the same result.
>
> Here is what I am trying to use now:
> If Cells(28, "P").Value < 43 Then
> Range("Q29:Q30").Value = ""
>
> Any suggestions?
>
> Thanks in advance

 
Reply With Quote
 
bumper338
Guest
Posts: n/a
 
      6th Mar 2008
Here is the code that I am having problems with:

If Cells(28, "P").Value < 43 Then
Range("Q29:Q30").Value = ""

Apparently when I changed the Cells to be less than or greater than it does
not work. I have tried using the ClearContents and tried using a null value
and it does not clear the cell range that I have identified.

Am I not able to us greater than or less than?

"JLGWhiz" wrote:

> You can also use ClearContents
> If Cells(13, "E").Value = "" And Cells(13, "G").Value = "" Then
> Range("P13:T13").ClearContents
> End If
>
> What are you having a problem with? There does not appear to be a problem
> with the code you posted.
>
> "bumper338" wrote:
>
> > I have done something like this before in vba, but when I try it now it is
> > not working. Here is what I want to do, if a value of cell c1 is < 0.01,
> > then I want the the value of cell d1 = "".
> >
> > Here is what I used before:
> >
> > If Cells(13, "E").Value = "" And Cells(13, "G").Value = "" Then
> > Range("P13:T13").Value = ""
> >
> > I realize that the cells here where equal to null, but I thought if the I
> > used > or < that I would get the same result.
> >
> > Here is what I am trying to use now:
> > If Cells(28, "P").Value < 43 Then
> > Range("Q29:Q30").Value = ""
> >
> > Any suggestions?
> >
> > Thanks in advance

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clearing a cell basil Microsoft Excel Misc 4 30th Apr 2007 11:28 AM
Cell Clearing =?Utf-8?B?dHJ3YXJkNzk=?= Microsoft Excel Programming 2 9th Oct 2006 02:58 AM
Clearing a cell news.microsoft.com Microsoft Excel Programming 1 27th Apr 2006 06:38 PM
clearing a cell =?Utf-8?B?YWhlZ2c=?= Microsoft Excel New Users 2 1st Apr 2006 06:41 AM
clearing a cell genevieveg Microsoft Excel Misc 1 11th Jan 2006 01:26 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:03 PM.