Excel macro, if > 0 add 1 to cell!?!?

Closed
Craig Farish - Apr 8, 2011 at 01:51 AM
RWomanizer Posts 365 Registration date Monday February 7, 2011 Status Contributor Last seen September 30, 2013 - Apr 8, 2011 at 02:21 AM
Hi all

I am fairly new to writing macros and am completely baffled by what you guys know.

I have been reading for hours on various websites etc for something that i could manipulate into what i need but whatever i attempt to do so it fails.

Example:

I have data in a column (A),the lenght varies from from workbook to workbook. I want to loop through the data in this column and whenever the data is greater than 0 i want to add 1 to a specific cell (C4)

The logic is very simple but i just have no idear how to write this in code.

Any suggestions will be greatly appreciated.


Related:

1 response

RWomanizer Posts 365 Registration date Monday February 7, 2011 Status Contributor Last seen September 30, 2013 120
Apr 8, 2011 at 02:21 AM
hi Craig,


You can do it without using Macro,
just put the formula in Column C4 as,

=COUNTIF(A:A,">0")

you got he desired result.

Regards,
Rahul
0