Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Removing Cell/Row Values Condition

Hi all, I am new to Excel VBA and haven't a clue how to get started
here. I have the following spreadsheet:

ColA, ColB, ColC, ColD, ColE
PID #, Type, Density, Expenditure1, Expenditure2
116211, NEW, 30, $130,943.46, $295,834.92
116211, Modify, 0, $130,943.46, $295,834.92
116211, Unk, 0, $130,943.46, $295,834.92
116212, Modify, 0, $130,943.46, $295,834.92
116212, NEW, 12, $130,943.46, $295,834.92
116212, Unk, 0, $130,943.46, $295,834.92
116231, NEW, 100, $630,563.57, $316,575.00
116231, Modify, 0, $630,563.57, $316,575.00
116231, Unk, 0, $630,563.57, $316,575.00

What I would like to do is look at the PID # and Density 0 - if true,
then I would like to keep the data in ColD and ColE (most times this is
associated with type of NEW. If not true (Density<0) and PID is the
same as the value in the above row but Density <0 then I would like to
delete the value in ColD and ColE to prevent duplicate information.

Sub RemoveStuff()
Dim i As Long
i = 3
While Not IsEmpty(Cells(i, 1))
If Cells(i, 1).Value = Cells(i - 1, 1).Value And Cells(i, 3) <=
0 Then _
Range(Cells(i, 4), Cells(i, 5)).Clear
i = i + 1
Wend
End Sub

The above code works unless.... the first row (PID #) checked is a row
where Density <=0, meaning the next PID # is the one with Density being
0 - any suggestions?


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
Removing ''VALUES'' Mark D[_2_] Excel Worksheet Functions 5 March 25th 10 08:13 PM
How to add cell values until a condition changes GBExcel Excel Worksheet Functions 3 October 15th 09 05:44 PM
SUM OF NUM VALUES WITH CONDITION adeel via OfficeKB.com Excel Discussion (Misc queries) 4 October 29th 07 12:01 PM
Hide cell values based on a condition in another cell Cat Excel Worksheet Functions 1 January 4th 07 07:21 AM
Removing already used values Jim Brass Excel Programming 0 November 10th 04 02:04 AM


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