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

Closed
Craig Farish - 8 Apr 2011 à 01:51
RWomanizer Posts 365 Registration date Monday 7 February 2011 Status Contributor Last seen 30 September 2013 - 8 Apr 2011 à 02:21
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 7 February 2011 Status Contributor Last seen 30 September 2013 120
8 Apr 2011 à 02:21
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