Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default CountA, Subtotal and "move to the first cell in the next column"

Help,
I am using the"CountA" Worksheet function to paste data from another
sheet into the 1st empty cell starting at "B2". It works fine all the
way to row 14 but it continues to row 15.

I want it to reset the CountA function to 2 and not keep count 15 and
start all over at column "D2" down to "D14" and repeat to column "F2"
and so on.

What as I doing wrong? How do I do it?

MY CODES:

Sheets("Sheet1").Select
Range("A1").Select
'------------------------------------------------------------------------
''Column_Index_For_Calculation was initailzed to 0.
-----------------------------------------------------------------------

Column_Index_For_Calculation = Column_Index_For_Calculation + 1
second_MyRow = ActiveCell.row
second_MyCol = ActiveCell.Column
NumColumns = My_Current_Range.Columns.Count
'-----------------------------------------------------------------------------------------------------------
Sheets("The Calculations").Select
Calculation_Column = second_MyCol + Column_Index_For_Calculation
-----------------------------------------------------------------------------------------------------------
'Calculation_Column is at 4
Change_The Columns is at True
------------------------------------------------------------------------------------------
New_Calculation_Column: If Change_The_Columns = True Then
Selection.End(xlUp).Select
Selection.Offset(1,
0).Select
'Next_Line = 2
ActiveCell.Select
End If
'-----------------------------------------------------------------------------------------------------------------------
Next_Line = Application.WorksheetFunction.CountA(Range("b:b"),
NumColumns)
'---------------------------------------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------------------------------------
' Next line is 15 not 2. I cannot make it to restart the count on the
next column.

'------------------------------------------------------------------------------------------------------------------------
'-------------------------------------------------------------------------------------------------------------------------
Cells(Next_Line, Calculation_Column) = Date_For_Calculation '
DATES
Cells(Next_Line, (Calculation_Column + 1)) = Diff_for_Calculations
'DIFF
'----------------------------------------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------------------------------------
A B C D F
GAMES DATES DIFF DATE DIFF
1st item 1/17/2006 14 11/25/07 4
2nd item 1/31/2006 21
3rd item 2/21/2006 143
4th item 7/14/2006 25
5th item 8/8/2006 59
6th item 10/6/2006 35
7th item 11/10/2006 84
8th item 2/2/2007 18
9th item 2/20/2007 31
10th item 3/23/2007 18
11th item 4/10/2007 7
12th item 4/17/2007 3
13th item 4/20/2007 4
14th item 4/24/2007 52
15th item 11/25/2005 4

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default CountA, Subtotal and "move to the first cell in the next column"

Pls do not post in more than one group. Do you want the answers here or in
misc?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"LongBeachGuy" wrote in message
ups.com...
Help,
I am using the"CountA" Worksheet function to paste data from another
sheet into the 1st empty cell starting at "B2". It works fine all the
way to row 14 but it continues to row 15.

I want it to reset the CountA function to 2 and not keep count 15 and
start all over at column "D2" down to "D14" and repeat to column "F2"
and so on.

What as I doing wrong? How do I do it?

MY CODES:

Sheets("Sheet1").Select
Range("A1").Select
'------------------------------------------------------------------------
''Column_Index_For_Calculation was initailzed to 0.
-----------------------------------------------------------------------

Column_Index_For_Calculation = Column_Index_For_Calculation + 1
second_MyRow = ActiveCell.row
second_MyCol = ActiveCell.Column
NumColumns = My_Current_Range.Columns.Count
'-----------------------------------------------------------------------------------------------------------
Sheets("The Calculations").Select
Calculation_Column = second_MyCol + Column_Index_For_Calculation
-----------------------------------------------------------------------------------------------------------
'Calculation_Column is at 4
Change_The Columns is at True
------------------------------------------------------------------------------------------
New_Calculation_Column: If Change_The_Columns = True Then
Selection.End(xlUp).Select
Selection.Offset(1,
0).Select
'Next_Line = 2
ActiveCell.Select
End If
'-----------------------------------------------------------------------------------------------------------------------
Next_Line = Application.WorksheetFunction.CountA(Range("b:b"),
NumColumns)
'---------------------------------------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------------------------------------
' Next line is 15 not 2. I cannot make it to restart the count on the
next column.

'------------------------------------------------------------------------------------------------------------------------
'-------------------------------------------------------------------------------------------------------------------------
Cells(Next_Line, Calculation_Column) = Date_For_Calculation '
DATES
Cells(Next_Line, (Calculation_Column + 1)) = Diff_for_Calculations
'DIFF
'----------------------------------------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------------------------------------
A B C D F
GAMES DATES DIFF DATE DIFF
1st item 1/17/2006 14 11/25/07 4
2nd item 1/31/2006 21
3rd item 2/21/2006 143
4th item 7/14/2006 25
5th item 8/8/2006 59
6th item 10/6/2006 35
7th item 11/10/2006 84
8th item 2/2/2007 18
9th item 2/20/2007 31
10th item 3/23/2007 18
11th item 4/10/2007 7
12th item 4/17/2007 3
13th item 4/20/2007 4
14th item 4/24/2007 52
15th item 11/25/2005 4


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default CountA, Subtotal and "move to the first cell in the next column"

On Oct 16, 3:26 pm, "Don Guillett" wrote:
Pls do not post in more than one group. Do you want the answers here or in
misc?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"LongBeachGuy" wrote in message

ups.com...



Help,
I am using the"CountA" Worksheet function to paste data from another
sheet into the 1st empty cell starting at "B2". It works fine all the
way to row 14 but it continues to row 15.


I want it to reset the CountA function to 2 and not keep count 15 and
start all over at column "D2" down to "D14" and repeat to column "F2"
and so on.


What as I doing wrong? How do I do it?


MY CODES:


Sheets("Sheet1").Select
Range("A1").Select
'------------------------------------------------------------------------
''Column_Index_For_Calculation was initailzed to 0.
-----------------------------------------------------------------------


Column_Index_For_Calculation = Column_Index_For_Calculation + 1
second_MyRow = ActiveCell.row
second_MyCol = ActiveCell.Column
NumColumns = My_Current_Range.Columns.Count
'--------------------------------------------------------------------------*---------------------------------
Sheets("The Calculations").Select
Calculation_Column = second_MyCol + Column_Index_For_Calculation
---------------------------------------------------------------------------*--------------------------------
'Calculation_Column is at 4
Change_The Columns is at True
---------------------------------------------------------------------------*---------------
New_Calculation_Column: If Change_The_Columns = True Then
Selection.End(xlUp).Select
Selection.Offset(1,
0).Select
'Next_Line = 2
ActiveCell.Select
End If
'--------------------------------------------------------------------------*---------------------------------------------
Next_Line = Application.WorksheetFunction.CountA(Range("b:b"),
NumColumns)
'--------------------------------------------------------------------------*-------------------------------------------
'--------------------------------------------------------------------------*--------------------------------------------
' Next line is 15 not 2. I cannot make it to restart the count on the
next column.


'--------------------------------------------------------------------------*----------------------------------------------
'--------------------------------------------------------------------------*-----------------------------------------------
Cells(Next_Line, Calculation_Column) = Date_For_Calculation '
DATES
Cells(Next_Line, (Calculation_Column + 1)) = Diff_for_Calculations
'DIFF
'--------------------------------------------------------------------------*--------------------------------------------
'--------------------------------------------------------------------------*--------------------------------------------
A B C D F
GAMES DATES DIFF DATE DIFF
1st item 1/17/2006 14 11/25/07 4
2nd item 1/31/2006 21
3rd item 2/21/2006 143
4th item 7/14/2006 25
5th item 8/8/2006 59
6th item 10/6/2006 35
7th item 11/10/2006 84
8th item 2/2/2007 18
9th item 2/20/2007 31
10th item 3/23/2007 18
11th item 4/10/2007 7
12th item 4/17/2007 3
13th item 4/20/2007 4
14th item 4/24/2007 52
15th item 11/25/2005 4- Hide quoted text -


- Show quoted text -


here

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default CountA, Subtotal and "move to the first cell in the next column"

On Oct 16, 3:26 pm, "Don Guillett" wrote:
Pls do not post in more than one group. Do you want the answers here or in
misc?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"LongBeachGuy" wrote in message

ups.com...



Help,
I am using the"CountA" Worksheet function to paste data from another
sheet into the 1st empty cell starting at "B2". It works fine all the
way to row 14 but it continues to row 15.


I want it to reset the CountA function to 2 and not keep count 15 and
start all over at column "D2" down to "D14" and repeat to column "F2"
and so on.


What as I doing wrong? How do I do it?


MY CODES:


Sheets("Sheet1").Select
Range("A1").Select
'------------------------------------------------------------------------
''Column_Index_For_Calculation was initailzed to 0.
-----------------------------------------------------------------------


Column_Index_For_Calculation = Column_Index_For_Calculation + 1
second_MyRow = ActiveCell.row
second_MyCol = ActiveCell.Column
NumColumns = My_Current_Range.Columns.Count
'--------------------------------------------------------------------------*---------------------------------
Sheets("The Calculations").Select
Calculation_Column = second_MyCol + Column_Index_For_Calculation
---------------------------------------------------------------------------*--------------------------------
'Calculation_Column is at 4
Change_The Columns is at True
---------------------------------------------------------------------------*---------------
New_Calculation_Column: If Change_The_Columns = True Then
Selection.End(xlUp).Select
Selection.Offset(1,
0).Select
'Next_Line = 2
ActiveCell.Select
End If
'--------------------------------------------------------------------------*---------------------------------------------
Next_Line = Application.WorksheetFunction.CountA(Range("b:b"),
NumColumns)
'--------------------------------------------------------------------------*-------------------------------------------
'--------------------------------------------------------------------------*--------------------------------------------
' Next line is 15 not 2. I cannot make it to restart the count on the
next column.


'--------------------------------------------------------------------------*----------------------------------------------
'--------------------------------------------------------------------------*-----------------------------------------------
Cells(Next_Line, Calculation_Column) = Date_For_Calculation '
DATES
Cells(Next_Line, (Calculation_Column + 1)) = Diff_for_Calculations
'DIFF
'--------------------------------------------------------------------------*--------------------------------------------
'--------------------------------------------------------------------------*--------------------------------------------
A B C D F
GAMES DATES DIFF DATE DIFF
1st item 1/17/2006 14 11/25/07 4
2nd item 1/31/2006 21
3rd item 2/21/2006 143
4th item 7/14/2006 25
5th item 8/8/2006 59
6th item 10/6/2006 35
7th item 11/10/2006 84
8th item 2/2/2007 18
9th item 2/20/2007 31
10th item 3/23/2007 18
11th item 4/10/2007 7
12th item 4/17/2007 3
13th item 4/20/2007 4
14th item 4/24/2007 52
15th item 11/25/2005 4- Hide quoted text -


- Show quoted text -


I am sorry about the re-posting.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default CountA, Subtotal and "move to the first cell in the next colum

Since you are using the second argument for the CountA() function, you will
get one more than the count for argument 1. That is why you are getting 15.
If you want 14, then eliminate the second argument like:

Next_Line = Application.WorksheetFunction.CountA(Range("b2:b15 "))

If you use Range("B:B"). you are also including the header. I suggest you
read up on COUNTA in the Excel help files.

"LongBeachGuy" wrote:

On Oct 16, 3:26 pm, "Don Guillett" wrote:
Pls do not post in more than one group. Do you want the answers here or in
misc?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"LongBeachGuy" wrote in message

ups.com...



Help,
I am using the"CountA" Worksheet function to paste data from another
sheet into the 1st empty cell starting at "B2". It works fine all the
way to row 14 but it continues to row 15.


I want it to reset the CountA function to 2 and not keep count 15 and
start all over at column "D2" down to "D14" and repeat to column "F2"
and so on.


What as I doing wrong? How do I do it?


MY CODES:


Sheets("Sheet1").Select
Range("A1").Select
'------------------------------------------------------------------------
''Column_Index_For_Calculation was initailzed to 0.
-----------------------------------------------------------------------


Column_Index_For_Calculation = Column_Index_For_Calculation + 1
second_MyRow = ActiveCell.row
second_MyCol = ActiveCell.Column
NumColumns = My_Current_Range.Columns.Count
'------------------------------------------------------------------------------------------------------------
Sheets("The Calculations").Select
Calculation_Column = second_MyCol + Column_Index_For_Calculation
------------------------------------------------------------------------------------------------------------
'Calculation_Column is at 4
Change_The Columns is at True
-------------------------------------------------------------------------------------------
New_Calculation_Column: If Change_The_Columns = True Then
Selection.End(xlUp).Select
Selection.Offset(1,
0).Select
'Next_Line = 2
ActiveCell.Select
End If
'------------------------------------------------------------------------------------------------------------------------
Next_Line = Application.WorksheetFunction.CountA(Range("b:b"),
NumColumns)
'----------------------------------------------------------------------------------------------------------------------
'-----------------------------------------------------------------------------------------------------------------------
' Next line is 15 not 2. I cannot make it to restart the count on the
next column.


'-------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------
Cells(Next_Line, Calculation_Column) = Date_For_Calculation '
DATES
Cells(Next_Line, (Calculation_Column + 1)) = Diff_for_Calculations
'DIFF
'-----------------------------------------------------------------------------------------------------------------------
'-----------------------------------------------------------------------------------------------------------------------
A B C D F
GAMES DATES DIFF DATE DIFF
1st item 1/17/2006 14 11/25/07 4
2nd item 1/31/2006 21
3rd item 2/21/2006 143
4th item 7/14/2006 25
5th item 8/8/2006 59
6th item 10/6/2006 35
7th item 11/10/2006 84
8th item 2/2/2007 18
9th item 2/20/2007 31
10th item 3/23/2007 18
11th item 4/10/2007 7
12th item 4/17/2007 3
13th item 4/20/2007 4
14th item 4/24/2007 52
15th item 11/25/2005 4- Hide quoted text -


- Show quoted text -


I am sorry about the re-posting.


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
Is this possible: =counta(a1:a30) behind "text" same cell? trussdesigns Excel Worksheet Functions 6 August 13th 08 05:38 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Excel "Move or Copy" and "Delete" sheet functions dsiama Excel Worksheet Functions 1 December 28th 07 01:57 PM
CountA, Subtotal and "move to the first cell in the next column" LongBeachGuy Excel Worksheet Functions 1 October 16th 07 11:30 PM
CountA, Subtotal and "move to the first cell in the next column" LongBeachGuy Excel Discussion (Misc queries) 1 October 16th 07 10:57 PM


All times are GMT +1. The time now is 03:50 AM.

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"