Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Question involving VBA

Status
Not open for further replies.

MikeCitizens

Technical User
Aug 13, 2002
37
US
Hello all,

I have an excell spreadsheet that basically looks like this

118118 bank name -12345.00 12345.00
118119 bank name 12345.00 12345.00
118120 bank name 12345.00 -12345.00
118121 bank name 12345.00 12345.00
118122 bank name -12345.00 -12345.00

I need to create a macro that takes this spreadsheet and creates a new one only pulling the lines if one of the figures are negative. So the new spreadsheet would look like this

118118 bank name -12345.00 12345.00
118120 bank name 12345.00 -12345.00
118122 bank name -12345.00 -12345.00

Can this be done using a Macro? I am new at using VB so Im a little clueless on this one. Would it be easy just using a Excel formula?

Please anything that you can help me with would be appreciated.

Mike
 
Take a look at Advanced filter.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PH

thanks for the response. Im a little unsure how to use the advance filter. I assume I can have this built into a Macro. Thing is my users need to run this excel daily and get the above result and they are worse off in excel as I appear to be.

I have read another thread. thread707-934163 thats similar to my thread. But it involves entering values into the second sheet before running the filter. Is there another way to do this? And it looks like he has one condition where I have two, how do I reflect this?

Mike

 
Mike,

1. Your data ought to have Column Headings.

2. PHV's suggestion requires a Criteria that will reside in AT LEAST 2 cells -- the FIRST cell has the Column Heading, then SECOND cell has the Criteria Value.

So if your 2 columns containing negative values have these headings...
[tt]
Amount1 Amount2
[/tt]
then your criteria would be
[tt]
Amount1 Amount2
<0
<0
[/tt]
in SIX Cells

Skip,

[glasses] [red]Be advised:[/red] Researchers have found another Descartes trueism, "Cogito ergo spud."
"I think; therefore, I YAM!
[tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top