Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wrong starting cells( x,x)

Status
Not open for further replies.

User4Fun

Programmer
Aug 6, 2008
15
US
This runs great in 03 version, and one little problems happens in the 07 veriosn. I am begging for help.

When you run it for the first time. The infromatoin starts in A44 ( that is right )
the second time arround.
It starts itself in A43 ( that is very very bad)




Pleas help. I dont have 07 verison and I am giving this to a friend that keeps giving it back to me.

Here is the full code that creates the query.
Can you not upload attachements on this site?
Code:
Private Sub ShowAnalyzerGraphBtn_Click()
Dim intRow As Integer, intLastRow As Integer, intResultRow As Integer
Dim intAcu_Result As Integer, intIstep_Result As Integer
Dim strGrade As Integer, int_A_Result As Integer, int_I_Result As Integer
Dim strTeacher As String, strDataSheet As String, strTest As String
         
       'Get teacher and grade values from result page
             strTeacher = Sheets("ACUITY Vs ISTEP GRAPH").Range("B39")
             strGrade = Sheets("ACUITY Vs ISTEP GRAPH").Range("B41")
      'End
       
       'Error trapping
            'Faliure to select option button indicating grade
             If strGrade = "0" Then
                  MsgBox "You must select a grade.", vbExclamation, "Fairlawn Analyzer"
                  
                  
                  
                  GoTo Error_So_End:
             End If
      'End
        
       
       'Choosing the sheet with the right data
        Select Case strGrade
             Case 3
             strDataSheet = "O2N3"
             Case 4
             strDataSheet = "O3N4"
             Case 5
             strDataSheet = "O4N5"
        End Select
        
       'End
        
                 
       'Find number of rows used in the choosen data sheet
   
             intLastRow = Sheets(strDataSheet).UsedRange.Rows.Count
       
       'End
          
       ' Select the row that the new information will start on, in this case Cell A row 44
          intResultRow = 44
       ' End
           
       'Going through the loop to look back and forward between the
       'chosen data sheet and the result graph sheet to list students
             For intRow = 2 To intLastRow
                If Sheets(strDataSheet).Cells(intRow, 2) = strTeacher Then
                     If Sheets(strDataSheet).Cells(intRow, 3) = strGrade Then
                         Sheets("ACUITY Vs ISTEP GRAPH").Cells(intResultRow, 1) = Sheets(strDataSheet).Cells(intRow, 1)
                         intResultRow = intResultRow + 1
                     End If
                End If
             Next intRow
       'End
       
       
       ' Error trapping for
           ' Not having enought access ( info not available ) or bad teacher/grade combination
               If Sheets("ACUITY Vs ISTEP GRAPH").Range("A44").Value = "" Then
                     MsgBox "Improper Teacher/Grade selection or ACCESS DENIED.", vbExclamation, "Fairlawn Analyzer"
                     GoTo Error_So_End:
               End If
        ' End
      
    
      'Get strTest Value
        strTest = Sheets("ACUITY Vs ISTEP GRAPH").Range("B40")
      'End
      
      'Error Traping
        'Faliure to select a test
             If strTest = "" Then
                   MsgBox "You must select a test.", vbExclamation, "Fairlawn Analyzer"
                 GoTo Error_So_End:
             End If
      'End
        
      'Picking the right range for Acuity and ISTEP score based on test selection
           '  Dim intAcu_Result As Integer, intIstep_Result As Integer already declared
         If strTest = "Algebra and Functions" Then
            intIstep_Result = "24"
            intAcu_Result = "25"
         End If
        
         If strTest = "Computation" Then
            intIstep_Result = "22"
            intAcu_Result = "23"
         End If
        
         If strTest = "Data Analysis" Then
            intIstep_Result = "30"
            intAcu_Result = "31"
         End If
       
        If strTest = "English Language Scale" Then
            intIstep_Result = "32"
            intAcu_Result = "33"
        End If
        If strTest = "Geometry" Then
            intIstep_Result = "26"
            intAcu_Result = "27"
        End If
        If strTest = "Language Conventions" Then
            intIstep_Result = "18"
            intAcu_Result = "19"
        End If
        If strTest = "Literary Response and Analysis" Then
            intIstep_Result = "12"
            intAcu_Result = "13"
        End If
         If strTest = "Math Scale" Then
            intIstep_Result = "34"
            intAcu_Result = "35"
        End If
         If strTest = "Measurement" Then
            intIstep_Result = "28"
            intAcu_Result = "29"
        End If
         If strTest = "Number Sense" Then
            intIstep_Result = "20"
            intAcu_Result = "21"
        End If
        If strTest = "Read Comprehension" Then
            intIstep_Result = "10"
            intAcu_Result = "11"
        End If
        If strTest = "Read Vocabulary" Then
            intIstep_Result = "8"
            intAcu_Result = "9"
        End If
        If strTest = "Writing Applications" Then
            intIstep_Result = "16"
            intAcu_Result = "17"
        End If
        
        If strTest = "Writing Process" Then
            intIstep_Result = "14"
            intAcu_Result = "15"
        End If
        If strTest = "Acuity Problemsolving" Then
            intIstep_Result = "37"
            intAcu_Result = "36"
        End If
                 
    'End
        
        
        'Using the Student names that were found to find the test scores
                'based on result page cell B40
       'Logical Process
                ' Take value in page ACUITY Vs. ISTEP GRAPH in cell A 44 ( first student )
                ' Find the score under the right column
                
   
       
       
      'Find numer of rows used in the choosen data sheet
   
             intLastRow = Sheets(strDataSheet).UsedRange.Rows.Count
       
       'End finding number of rows
          
       ' Select the row that the new information will start on, in this case Cell A row 44
          intResultRow = 44
       ' End selecting row
           
       'Going through the loop to look back and forward between the
       'chosen data sheet and the result graph sheet to list students
             For intRow = 2 To intLastRow
                If Sheets("ACUITY Vs ISTEP GRAPH").Cells(intResultRow, 1) = Sheets(strDataSheet).Cells(intRow, 1) Then
                     ' Confirm the right student by confirming teacher to strTeacher incase of two same anme student with different teachers
                     If Sheets(strDataSheet).Cells(intRow, 2) = strTeacher Then
                         Sheets("ACUITY Vs ISTEP GRAPH").Cells(intResultRow, 2) = Sheets(strDataSheet).Cells(intRow, intIstep_Result)
                         Sheets("ACUITY Vs ISTEP GRAPH").Cells(intResultRow, 3) = Sheets(strDataSheet).Cells(intRow, intAcu_Result)
                         intResultRow = intResultRow + 1
                     End If
                End If
            Next intRow
       ' End
         
      ' Going to the result page and preparing the graph.
  Worksheets("ACUITY Vs ISTEP GRAPH").Select
   Unload TestAnalyzer
   Worksheets("ACUITY Vs ISTEP GRAPH").ChartObjects("acutep").Activate
    ActiveChart.HasTitle = True
    ActiveChart.ChartTitle.Text = strGrade & "th Grade " & Sheets("ACUITY Vs ISTEP GRAPH").Range("B40") & " -Acuity vs ISTEP scores"
    
    ActiveChart.SetSourceData Source:=Range("graph_info")
  
  
'finding highest score achieved to decide on max scale
Dim rg As Range
Dim Maximum As Double
With Sheets("Acuity Vs ISTEP GRAPH")
    Set rg = .Range("B44", .[C65536].End(3))
    Maximum = Application.Max(rg)
    Maximum = Maximum + 7
    .ChartObjects("acutep").Chart.Axes(2).MaximumScale = Maximum
    .ChartObjects("acutep").Chart.Axes(2).MinimumScale = 0
End With


    Worksheets("ACUITY Vs ISTEP GRAPH").Range("graph_Info").Sort _
        Key1:=Worksheets("ACUITY Vs ISTEP GRAPH").Range("C44"), _
        Key2:=Worksheets("ACUITY Vs ISTEP GRAPH").Range("B44")
      'End
    
    
       'Code to ensure full view of the grph by select cell A1
    Worksheets("Acuity Vs ISTEP GRAPH").Cells(1, 1).Select
    
      
Error_So_End:

End Sub

If you made it down this far and you dont see anyting that would make the 07 version geting all freaky on me. I beg to go back and looka again. I am desperate for help.
 
That does not allow you to upload an attachment! that just makes you put in a url!!

I want to browse my hard drive to pick a file, not just give you a url
 




Please FOCUS you code example on the problem area and not the entire procedure.

Have you put breaks in your code and observed the values that affect this issue?

Have you used the Watch Window to observe the values and objects at your breaks?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
That does not allow you to upload an attachment! that just makes you put in a url!!
My bad. At the sister site , that Step 3 actually allows you to upload. Strange that they built a parallel interface here, but no parallel functionality.
 
no biggie, I was going crazy for minute trying to get it to upload a file. lol
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top