Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 5th, 2007, 07:24 AM
Authorized User
 
Join Date: Apr 2007
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default Replace the cells having negative value

I want to replace the negative numbers in a given range of cells. I need that range of cells to become blanks, so that i can filter that range and delete the entire rows.



Yogesh
__________________
Yogesh
 
Old May 6th, 2007, 10:45 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

This code is for u

Sub DelNegs()
Dim Rng As Range
For Each Rng In Selection
    If Rng.Value < 0 Then
        Rng.ClearContents
    End If
Next
End Sub


-vemaju
 
Old July 18th, 2011, 02:55 AM
Registered User
 
Join Date: Jul 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default please tell me ......

actually m trying to do the same thing but m unable in it... whenever m trying to run this , it dosnt show any reponse. will u please tell me wht 'll i do...
 
Old July 18th, 2011, 10:27 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Megha can you state your problem clearly - what you intend to do and what is not happening

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips &amp; Tricks (http://www.vbadud.blogspot.com)
 
Old April 29th, 2016, 01:43 PM
Registered User
 
Join Date: Apr 2016
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default neat code. Thanks.

small and clean code. thanks.


Quote:
Originally Posted by vemaju View Post
Hi,

This code is for u

Sub DelNegs()
Dim Rng As Range
For Each Rng In Selection
    If Rng.Value < 0 Then
        Rng.ClearContents
    End If
Next
End Sub


-vemaju





Similar Threads
Thread Thread Starter Forum Replies Last Post
Index was out of range. Must be non-negative raghavendra_das ASP.NET 2.0 Professional 0 July 24th, 2008 08:16 AM
Replace all cells having value <=zero yogeshyl Excel VBA 1 May 16th, 2007 02:26 PM
Making a number negative Corey Access 1 February 2nd, 2007 11:48 AM
Index 0 is not non-negative! ktsis ASP.NET 1.0 and 1.1 Basics 1 July 5th, 2006 09:00 PM
negative number returned when subtracting gavmc Classic ASP Basics 2 November 29th, 2005 06:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.