LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default sub total


I have code here. it is updating the summary . but it is not totalling
properly. please correct ti and resend it to me my email address is


Sub Get_Totals()
Application.ScreenUpdating = False
Dim mystrdate
Dim mystrname
Dim mylen As Integer
Dim sumlastrow As Long
Dim invlastrow As Long
Dim thiscol As Integer
Dim lastrow As Integer
Dim f As Integer
invlastrow = Sheets("Inventory
Template").Range("C65336").End(xlUp).Row
Sheets("Summary").Range("B5:C2000").ClearContents
For f = 7 To invlastrow
mystrname = Trim(Cells(f, 3).Text) '' This set the name
mystrdate = Right(Cells(f, 14), 4) ''this is for the date
If mystrdate < 1990 Then ''' now check each cell for years less
than 1990
Range(Cells(f, 1), Cells(f, 50)).Interior.ColorIndex = "6" ''
color to yellow if < 1990
ElseIf mystrdate 1990 And mystrdate < "" Then
Range(Cells(f, 1), Cells(f, 50)).Interior.ColorIndex = "8" ''
color to blue if 1990
ElseIf Cells(f, 4).Text = "Master" Then
Range(Cells(f, 1), Cells(f, 50)).Interior.ColorIndex = "8"
End If
Sheets("Summary").Activate
sumlastrow = Sheets("Summary").Range("A65336").End(xlUp).Row + 1
''get lastrow on summry
On Error Resume Next
Sheets("Summary").Cells.Find(What:=mystrname,
LookAt:=xlWhole).Select
If Sheets("Summary").Cells(ActiveCell.Row, 2).Value = "" Then
Sheets("Summary").Cells(ActiveCell.Row, 2).Value = 0
Sheets("Summary").Cells(ActiveCell.Row, 3).Value = 0
End If
If Err = "91" Then
Sheets("Summary").Cells(sumlastrow, 1).Value = mystrname
Sheets("Summary").Cells(sumlastrow, 1).Select
Sheets("Summary").Cells(sumlastrow, 2).Value = 0
Sheets("Summary").Cells(sumlastrow, 3).Value = 0
End If
If mystrdate < 1990 Then ''' now check each cell for years less
than 1990
ActiveCell.Offset(, 2).Value = ActiveCell.Offset(, 2).Text
+ 1 ''add to total
Else
ActiveCell.Offset(, 1).Value = ActiveCell.Offset(, 1).Text
+ 1 '''add to total
End If

Sheets("Inventory Template").Activate
Next f
End Sub


--
kamakshi
------------------------------------------------------------------------
kamakshi's Profile:
http://www.excelforum.com/member.php...o&userid=27714
View this thread: http://www.excelforum.com/showthread...hreadid=472303

 
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
Duplicate Running Total Grand Total In Pivot Table Mathew P Bennett[_2_] Excel Discussion (Misc queries) 1 August 17th 08 03:13 AM
Excel 2002 : Any single button to get sub total and grand total ? Mr. Low Excel Discussion (Misc queries) 2 May 22nd 07 08:46 AM
Total column changes colors when total equals sum of other columns newstacy New Users to Excel 1 April 21st 07 09:00 PM
Pivots - Auto calc % Sub total is of grand total VBA Noob Excel Discussion (Misc queries) 3 August 8th 06 08:46 PM
Adding Data Using Multiple Worksheets to Total into a Grand Total Lillie Excel Worksheet Functions 1 April 19th 05 08:34 PM


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