m_jeyprakash@yahoo.com
New Member
I am new to this VBA project. I have an issue with my current project. any help by today EOD is appreciated.
The Issue.
I have an excel file which has sheets as "Report", "OverallProgram"...
In the "Report" sheet I have a chart(graph) which should show the graph of data from the sheet "OverallProgram" I have 45 rows of column in the "OverallProgram" sheet, but the graph in "Report" sheet shows only upto the 25 rows.
The graph shows only the data from the range B2:F24 but it should show the data from the range B2:F48
The code is
Public Sub OverallProgram_TestScript()
On Error Resume Next
x_TDconnect
Set Sh = ThisWorkbook.Sheets("OverallProgram")
'Set sh1 = ThisWorkbook.Sheets("Credentials")
ReleaseNames = "'" & Selected_App & "'"
Query = "select planned_date, re_forcasting, sum(executed) over (partition by rel_id order by planned_date ROWS BETWEEN UNBOUNDED PRECEDING AND current row) executed,Passed from (select rel_id, to_char(tc_plan_scheduling_date,'MM/DD/YYYY') planned_date, sum(case when tc_exec_date > tc_plan_scheduling_date then 1 else 0 end) Re_forcasting, sum(case when tc_status in ('Passed', 'Failed') then 1 else null end ) Executed, sum(case when tc_status in ('Passed') then 1 else 0 end) Passed from TESTCYCL tcl, releases rls, RELEASE_CYCLES rcl where tcl.TC_ASSIGN_RCYC= rcl.RCYC_ID and rcl.rcyc_parent_id=rls.rel_id and tc_plan_scheduling_date is not null and rls.rel_name = " & ReleaseNames & " group by to_char(tc_plan_scheduling_date,'MM/DD/YYYY') , rel_id ) order by planned_date"
Set comExecute = TDConnection.Command
comExecute.CommandText = Query
Set RecSet = comExecute.Execute
COUNT1 = RecSet.RecordCount
PrevCount = Sh.Cells(1, 1)
Sh.Cells(1, 1) = COUNT1
Sh.Range("B3:F" & PrevCount).Select
Selection.ClearContents
l = 3
m = 2
Reforecast = 0
Passed = 0
If COUNT1 > 0 Then
Sh.Range("B3:F" & l + COUNT1 - 1).Select
Selection.ClearContents
Sh.Range("B3:F" & l + COUNT1 - 1).Value = "0"
For k = 1 To COUNT1
For j = 0 To 10
If j = 0 Then
Sh.Cells(l, m) = RecSet(j)
Sh.Cells(l, m + 1) = ""
Else
Sh.Cells(l, m + 1) = RecSet(j)
If (m = 3) Then
Reforecast = Reforecast + RecSet(j)
Sh.Cells(l, m + 1) = Reforecast
ElseIf (m = 5) Then
Passed = Passed + RecSet(j)
Sh.Cells(l, m + 1) = Passed
End If
End If
m = m + 1
Next
l = l + 1
RecSet.Next
m = 2
Next
End If
'MsgBox "OverallProgramTestScript Report Generated Successfully !!! Please refer to Reports Sheet for Complete Report!!!", vbInformation, "Reports Generated"
TDConnection.Disconnect
TDConnection.ReleaseConnection
Set TDConnection = Nothing
ActiveSheet.ChartObjects("OverallProgramTestScript").Activate
ActiveChart.SetSourceData Source:=Sheets("OverallProgram").Range("C2:F" & COUNT1 + 3)
ActiveChart.SeriesCollection(1).XValues = "='OverallProgram'!$B$3:$F$ " & COUNT1 + 3
Cells.Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Range("B2:F" & COUNT1 + 3).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Range("B2:F2").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Range("B2:F" & COUNT1 + 3).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
>.TintAndShade = 0
.Weight = xlThin
End With
Err_Handler:
On Error Resume Next
TDConnection.Disconnect
TDConnection.Logout
TDConnection.ReleaseConnection
Set TDConnection = Nothing
On Error GoTo 0
End Sub
Query is working fine. only thing is the data in the graph is not showing upto the end.
could anybody help me with this issue its very urgent.
The Issue.
I have an excel file which has sheets as "Report", "OverallProgram"...
In the "Report" sheet I have a chart(graph) which should show the graph of data from the sheet "OverallProgram" I have 45 rows of column in the "OverallProgram" sheet, but the graph in "Report" sheet shows only upto the 25 rows.
The graph shows only the data from the range B2:F24 but it should show the data from the range B2:F48
The code is
Public Sub OverallProgram_TestScript()
On Error Resume Next
x_TDconnect
Set Sh = ThisWorkbook.Sheets("OverallProgram")
'Set sh1 = ThisWorkbook.Sheets("Credentials")
ReleaseNames = "'" & Selected_App & "'"
Query = "select planned_date, re_forcasting, sum(executed) over (partition by rel_id order by planned_date ROWS BETWEEN UNBOUNDED PRECEDING AND current row) executed,Passed from (select rel_id, to_char(tc_plan_scheduling_date,'MM/DD/YYYY') planned_date, sum(case when tc_exec_date > tc_plan_scheduling_date then 1 else 0 end) Re_forcasting, sum(case when tc_status in ('Passed', 'Failed') then 1 else null end ) Executed, sum(case when tc_status in ('Passed') then 1 else 0 end) Passed from TESTCYCL tcl, releases rls, RELEASE_CYCLES rcl where tcl.TC_ASSIGN_RCYC= rcl.RCYC_ID and rcl.rcyc_parent_id=rls.rel_id and tc_plan_scheduling_date is not null and rls.rel_name = " & ReleaseNames & " group by to_char(tc_plan_scheduling_date,'MM/DD/YYYY') , rel_id ) order by planned_date"
Set comExecute = TDConnection.Command
comExecute.CommandText = Query
Set RecSet = comExecute.Execute
COUNT1 = RecSet.RecordCount
PrevCount = Sh.Cells(1, 1)
Sh.Cells(1, 1) = COUNT1
Sh.Range("B3:F" & PrevCount).Select
Selection.ClearContents
l = 3
m = 2
Reforecast = 0
Passed = 0
If COUNT1 > 0 Then
Sh.Range("B3:F" & l + COUNT1 - 1).Select
Selection.ClearContents
Sh.Range("B3:F" & l + COUNT1 - 1).Value = "0"
For k = 1 To COUNT1
For j = 0 To 10
If j = 0 Then
Sh.Cells(l, m) = RecSet(j)
Sh.Cells(l, m + 1) = ""
Else
Sh.Cells(l, m + 1) = RecSet(j)
If (m = 3) Then
Reforecast = Reforecast + RecSet(j)
Sh.Cells(l, m + 1) = Reforecast
ElseIf (m = 5) Then
Passed = Passed + RecSet(j)
Sh.Cells(l, m + 1) = Passed
End If
End If
m = m + 1
Next
l = l + 1
RecSet.Next
m = 2
Next
End If
'MsgBox "OverallProgramTestScript Report Generated Successfully !!! Please refer to Reports Sheet for Complete Report!!!", vbInformation, "Reports Generated"
TDConnection.Disconnect
TDConnection.ReleaseConnection
Set TDConnection = Nothing
ActiveSheet.ChartObjects("OverallProgramTestScript").Activate
ActiveChart.SetSourceData Source:=Sheets("OverallProgram").Range("C2:F" & COUNT1 + 3)
ActiveChart.SeriesCollection(1).XValues = "='OverallProgram'!$B$3:$F$ " & COUNT1 + 3
Cells.Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Range("B2:F" & COUNT1 + 3).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Range("B2:F2").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Range("B2:F" & COUNT1 + 3).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
>.TintAndShade = 0
.Weight = xlThin
End With
Err_Handler:
On Error Resume Next
TDConnection.Disconnect
TDConnection.Logout
TDConnection.ReleaseConnection
Set TDConnection = Nothing
On Error GoTo 0
End Sub
Query is working fine. only thing is the data in the graph is not showing upto the end.
could anybody help me with this issue its very urgent.