Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
WendiL99
 
Posts: n/a
Default Decoding an old macro

I'm trying to understand and simplify an enormous macro that was written in
1999. I came across a section that I don't understand what it is doing. The
macro is

'Neg Amounts (AccDep, GnLss, Purch only)...Other Accounts Count
Range("A1").Select
Range("A2").Select
AccountsCost = 0
Do While ActiveCell.Range("A1") 0
AccountsCost = AccountsCost + 1
ActiveCell.Offset(1, 0).Range("A1").Select
Loop
Range("A1").Select

A sample of the data:

Co Acct Sum Of Expr1
3342010 16,295.00
3344010 382,039.00
3348010 100,467.00
4300010 466,752.00
4302010 62,314.00

Can someone tell me what this is doing? Thanks!!

  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Decoding an old macro

It just counts how many cells from A2 down have a value 0. It can be done
simpler with


AccountsCost = Application.CountIf(Range("A2:A" &
Range("A2").End(xlDown).Row), "0")

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"WendiL99" wrote in message
...
I'm trying to understand and simplify an enormous macro that was written

in
1999. I came across a section that I don't understand what it is doing.

The
macro is

'Neg Amounts (AccDep, GnLss, Purch only)...Other Accounts Count
Range("A1").Select
Range("A2").Select
AccountsCost = 0
Do While ActiveCell.Range("A1") 0
AccountsCost = AccountsCost + 1
ActiveCell.Offset(1, 0).Range("A1").Select
Loop
Range("A1").Select

A sample of the data:

Co Acct Sum Of Expr1
3342010 16,295.00
3344010 382,039.00
3348010 100,467.00
4300010 466,752.00
4302010 62,314.00

Can someone tell me what this is doing? Thanks!!



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
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
macro with F9 Kenny Excel Discussion (Misc queries) 1 August 3rd 05 02:41 PM
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


All times are GMT +1. The time now is 04:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"