View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Inaccurate count with code

hi Howard,

Am Tue, 5 Mar 2013 12:30:45 -0800 (PST) schrieb Howard:

Do see why this would return inaccurate counts of the values listed in F1:F4sheet 1? There are three sheets in the workbook. I have checked for leading-trailing spaces, copied and pasted to assure spelling and upper case is same - same.

If I copy and paste Reject in say two sheet. should return 2, maybe will or maybe returns 0. Tried several seneraios to try to detect a trend but it is too random to make any assumptions.

The Msgbox and Range print out depict the same errors.


if you don't run the macro from sheet 1 you will get false results.
Therefore change the initializing of i to l:

With Sheets(1)
i = .Range("F1").Value
j = .Range("F2").Value
k = .Range("F3").Value
l = .Range("F4").Value
End With


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2