Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default CountA Problems

I plan to copy a few cells from a workbook "Store" to another one called
"Sales". I am putting this data into the worksheet in rows once a day. I am
using a command button on Sheet("Store") to do this with the following code:

Sub cmdUpdateSales()

Sheets("Sales").Activate
Sheets("Sales).Select 'this may be overkill

NextRow = Workbookfunction.CountA.Range("A1:A100") +1 'I want to count
the rows on "Sales"

MsgBox NextRow

More code here

End Sub

The results of the message box show that 0 rows have been counted, because
the NextRow functions seems to counting on Sheet("Store") instead of
Sheet("Sales"). Sheet("Sales") does have a header row which should give a
row count of at least "1". What am I doing wrong? Can you help?

Thanks for the help

TucsonBob


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default CountA Problems

Robert, try this, you say from workbook to another workbook but then it
looks like you are going from worksheet to another worksheet, this is for
worksheet to worksheet

Sub cmdUpdateSales()

Sheets("Sales").Activate
Sheets("Sales").Select 'this may be overkill

NextRow = Application.CountA(Range("A1:A100")) + 1 'I want to count
'the rows on "Sales"

MsgBox NextRow

'More code here

End Sub

Don't know what the rest of your code is doing, or why you are adding 1 to
the count, maybe should be -1 to take out the header row?
most of the time you do not need to select a sheet or cells to work with
them so this should work also, but maybe not with the rest of your code, you
most likely can copy the data from one sheet to another one without
selecting it


Sub cmdUpdateSales2()

NextRow = Application.CountA(Sheets("Sales").Range("A1:A100" )) + 1 'I
want to count
'the rows on "Sales"

MsgBox NextRow

'More code here

End Sub



--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Robert Kedzie" wrote in message
news:Rmybe.3748$Zi.2923@fed1read04...
I plan to copy a few cells from a workbook "Store" to another one called
"Sales". I am putting this data into the worksheet in rows once a day. I

am
using a command button on Sheet("Store") to do this with the following

code:

Sub cmdUpdateSales()

Sheets("Sales").Activate
Sheets("Sales).Select 'this may be overkill

NextRow = Workbookfunction.CountA.Range("A1:A100") +1 'I want to

count
the rows on "Sales"

MsgBox NextRow

More code here

End Sub

The results of the message box show that 0 rows have been counted, because
the NextRow functions seems to counting on Sheet("Store") instead of
Sheet("Sales"). Sheet("Sales") does have a header row which should give a
row count of at least "1". What am I doing wrong? Can you help?

Thanks for the help

TucsonBob




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
Offset/COUNTA problems [email protected] Excel Worksheet Functions 4 June 17th 08 03:22 PM
Counta martins New Users to Excel 2 April 4th 06 12:04 AM
COUNTA Karen Excel Worksheet Functions 3 January 10th 06 09:48 PM
Problems copying cells using offset and counta hlckom Excel Discussion (Misc queries) 4 January 30th 05 12:49 AM
COUNTA Function not working =COUNTA(C3:C69,"NH") MikeinNH Excel Worksheet Functions 2 November 8th 04 01:19 AM


All times are GMT +1. The time now is 08:07 PM.

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

About Us

"It's about Microsoft Excel"