Hi there i am not done any programing
I need help in the below code i am not getting the value what i want in the code below
End If
Range("Q39").Value = Ssu(0)
Range("T39").Value = " / " & Tsu(0)
Range("X39").Value = Ssu(0) / Tsu(0)
Range("Q43").Value = Ssu(9)
Range("T43").Value = " / " & Tsu(9)
Range("X43").Value = Ssu(9) / Tsu(9)
Range("Q41").Value = Ssu(0)
Range("T41").Value = " / " & Tsu(0)
Range("X41").Value = Ssu(0) / Tsu(0)
Range("Q42").Value = Ssu(0)
Range("T42").Value = " / " & Tsu(0)
Range("X42").Value = Ssu(0) / Tsu(0)
Range("Q40").Value = Ssu(0)
Range("T40").Value = " / " & Tsu(0)
Range("X40").Value = Ssu(0) / Tsu(0)
If you see the value in T39 and T41 is correect but the toher value is not ok if i change i get overflow error 6 please help i am in urgetn need
Private Tsu(9) As Integer
Private Ssu(9) As Integer
Private Sub Total_Cal(index As Long)
Erase Tsu, Ssu
With Worksheets("L-Score")
For ri = 5 To 313
If .Cells(ri, 1).Value = String(index, "*") Then
Tsu(0) = Tsu(0) + Val(.Cells(ri, 3).Value)
Ssu(0) = Ssu(0) + Val(.Cells(ri, 7).Value)
Tsu(9) = Tsu(9) + Val(.Cells(ri, 6).Value)
Ssu(9) = Ssu(9) + Val(.Cells(ri, 8).Value)
Select Case .Cells(ri + (2 / index) + 1, 1).Value
Case "5-2-1", "5-2-2", "5-2-3"
Tsu(1) = Tsu(1) + Val(.Cells(ri, 3).Value)
Ssu(1) = Ssu(1) + Val(.Cells(ri, 7).Value)
Case "5-2-4", "5-2-5", "5-2-6", "5-2-7", "5-2-8"
Tsu(2) = Tsu(2) + Val(.Cells(ri, 3).Value)
Ssu(2) = Ssu(2) + Val(.Cells(ri, 7).Value)
Case "7-1-1", "7-2-1", "7-3-1", "7-4-1", "7-5-1", "7-7-1"
Tsu(3) = Tsu(3) + Val(.Cells(ri, 3).Value)
Ssu(3) = Ssu(3) + Val(.Cells(ri, 7).Value)
End Select
End If
Next ri
End With
End Sub
'---------------------------------------------------
'-- Worksheets Application Activate ---
'---------------------------------------------------
Private Sub Worksheet_Activate()
Att1 = "Field Dept."
Score_set
With Worksheets("L-Info")
Range("G6").Value = Format(Date, "yyyy") & "/" & Format(Date, "mm") & "/" & Format(Date, "dd")
If TciS = 1 Then
Range("G8").Value = Worksheets("Data").Cells(4, 25).Value
Else
Range("G8").Value = Worksheets("Data").Cells(4, 27).Value
End If
Shapes("Picture 3").Select
Selection.ShapeRange.LockAspectRatio = msoFalse
If TciS = 1 Then
Selection.ShapeRange.Height = 0
Selection.ShapeRange.Width = 0
Select Case Rci
Case 1
Range("W2").Value = "AS-Dos1"
Range("B28").Value = .Cells(59, 1).Value
Range("B31").Value = .Cells(64, 1).Value
Case 2
Range("W2").Value = "AS-Dos2"
Range("B28").Value = .Cells(60, 1).Value
Range("B31").Value = .Cells(65, 1).Value
Case 3
Range("W2").Value = "AS-Dos3"
Range("B28").Value = .Cells(61, 1).Value
Range("B31").Value = .Cells(66, 1).Value
End Select
Range("O38").Value = .Cells(Oci + 5, 1).Value
Total_Cal 1
Else
Selection.ShapeRange.Height = 62.25
Selection.ShapeRange.Width = 90
If Rci = 1 Then
Range("W2").Value = "B&P3"
Range("B28").Value = .Cells(62, 1).Value
Range("B31").Value = .Cells(67, 1).Value
Else
Range("W2").Value = "B&P4"
Range("B28").Value = .Cells(63, 1).Value
Range("B31").Value = .Cells(68, 1).Value
End If
.Range("O38").Value = ""
Total_Cal 2
End If
Range("O33").Value = .Cells(Rci + 68, 1).Value & " (" & .Cells(Rci + 15, 1).Value & ")"
Range("C35").Value = .Cells(72, 1).Value
If Rci = 1 Then
Rows(35).RowHeight = 15
If TciS = 1 Then
Range("O35").Value = Worksheets("Data").Cells(4, 26).Value
Else
Range("O35").Value = Worksheets("Data").Cells(4, 28).Value
End If
Rows("44:49").RowHeight = 0
Else
Rows(35).RowHeight = 0
Rows("44:49").RowHeight = 15
End If
Range("Q39").Value = Ssu(0)
Range("T39").Value = " / " & Tsu(0)
Range("X39").Value = Ssu(0) / Tsu(0)
Range("Q43").Value = Ssu(9)
Range("T43").Value = " / " & Tsu(9)
Range("X43").Value = Ssu(9) / Tsu(9)
Range("Q41").Value = Ssu(0)
Range("T41").Value = " / " & Tsu(0)
Range("X41").Value = Ssu(0) / Tsu(0)
Range("Q42").Value = Ssu(0)
Range("T42").Value = " / " & Tsu(0)
Range("X42").Value = Ssu(0) / Tsu(0)
Range("Q40").Value = Ssu(0)
Range("T40").Value = " / " & Tsu(0)
Range("X40").Value = Ssu(0) / Tsu(0)
Range("D36").Value = .Cells(TciS + 72, 1).Value
Range("D44").Value = .Cells(TciS + 79, 1).Value
Range("O44").Value = .Cells(TciS + 81, 1).Value
End With
For ri = 1 To 999
If Worksheets("Dist-Code").Cells(ri, 1).Value = "" Then Exit For
If Format(Worksheets("Dist-Code").Cells(ri, 1).Value) = Format(Worksheets("Data").Cells(4, 10).Value) Then Exit For
Next ri
If Worksheets("Dist-Code").Cells(ri, 5).Value = "" Then sw = "FONE2" Else sw = Worksheets("Dist-Code").Cells(ri, 5).Value
With Worksheets("App_Address")
For ci = 1 To 5
If InStr(sw, .Cells(1, ci).Value) > 0 Then
For ri = 2 To 17
w = .Cells(ri, ci).Value
If sw = "FONE2" And ri = 2 Then w = Replace(w, "No.1", "No.2")
Cells(ri + 8, 3).Value = w
Next ri
Exit For
End If
Next ci
End With
PrintPreview (True)
Worksheets("S-Application").Visible = False
Worksheets("Top").Activate
Pno = 5
UserMain.Show
End Sub
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar