Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default WorksheetFunction Calculation Error

errorWS.Range("B3").Value = Application.WorksheetFunction.CountA("A5:A" &
errorWS_startRow - 1)

The above line of code is always 1, even when errorWS_startRow is much 1,
i.e:
errorWS_startRow=144, 749 etc.

Any ideas what is going on?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 395
Default WorksheetFunction Calculation Error

I'd suggest including the sheet reference for the CountA; something like this
(untested)

errorWS.Range("B3").Value =
Application.WorksheetFunction.CountA(errorWS.Range ("A5:A" &
errorWS_startRow - 1))

"Ayo" wrote:

errorWS.Range("B3").Value = Application.WorksheetFunction.CountA("A5:A" &
errorWS_startRow - 1)

The above line of code is always 1, even when errorWS_startRow is much 1,
i.e:
errorWS_startRow=144, 749 etc.

Any ideas what is going on?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default WorksheetFunction Calculation Error

If the cells from A5 to A & errorWS_startRow-1 are empty, you will get
either 1 or zero depending on whether there is data in the startRow - 1 or
not. CountA only counts cells with data that has a value. It will not
count empty cells but does count cells with zero, "" or ' characters that
are hidden because they have values. So, the range you are testing must be
empty except for one cell.



"Ayo" wrote in message
...
errorWS.Range("B3").Value = Application.WorksheetFunction.CountA("A5:A" &
errorWS_startRow - 1)

The above line of code is always 1, even when errorWS_startRow is much
1,
i.e:
errorWS_startRow=144, 749 etc.

Any ideas what is going on?



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
worksheetfunction.sum error Monique Excel Programming 4 July 17th 05 04:43 PM
Error '1004' in WorksheetFunction oakman[_16_] Excel Programming 0 November 18th 04 01:48 PM
Error '1004' in WorksheetFunction oakman[_15_] Excel Programming 1 November 17th 04 08:16 PM
Error '1004' in WorksheetFunction oakman[_14_] Excel Programming 1 November 17th 04 03:56 PM


All times are GMT +1. The time now is 11:45 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"