I've fixed the problem now, i realised that the 2 times i was using were in different formats, one did not have the seconds added to them, so after adding this it gave me the correct values. Also to solve the problem of it not including the 1st value i did all of the data, then at the end i put the title to the columns at the end.
Sub Test2()
Sheet6.Select
Range("A1").EntireColumn.Select
Selection.Delete
Range("A1").EntireColumn.Select
Selection.Delete
If Sheet1.Range("A1") = "Rain" Then
Sheet2.Select
ElseIf Sheet1.Range("A1") = "Temp" Then
Sheet3.Select
ElseIf Sheet1.Range("A1") = "Part" Then
Sheet4.Select
Else: MsgBox "Error! Please restart the system."
End If
i = 1
j = 1
Set vType = ActiveSheet.Cells(i, "A")
Set vCelli = ActiveSheet.Cells(i, "B")
Set vCellc = ActiveSheet.Cells(i, "C")
Set vCriti = Sheet5.Cells("3", "A")
Set vCritc = Sheet5.Cells("3", "B")
Set vCur6 = Sheet6.Cells(j, "A")
Set vType6 = Sheet6.Cells(j, "B")
Do
If vCelli.Value >= vCriti.Value And vCellc.Value <= vCritc.Value Then
Do
If IsEmpty(vCur6) Then
vCur6.Value = vCellc.Value
vType6.Value = vType.Value
Else
j = j + 1
Set vCur6 = Sheet6.Cells(j, "A")
Set vType6 = Sheet6.Cells(j, "B")
End If
Loop Until IsEmpty(vCur6)
i = i + 1
Set vType = ActiveSheet.Cells(i, "A")
Set vCelli = ActiveSheet.Cells(i, "B")
Set vCellc = ActiveSheet.Cells(i, "C")
Else
i = i + 1
Set vType = ActiveSheet.Cells(i, "A")
Set vCelli = ActiveSheet.Cells(i, "B")
Set vCellc = ActiveSheet.Cells(i, "C")
End If
Loop Until IsEmpty(vCelli)
Sheet6.Select
Range("A1").EntireRow.Select
Selection.Insert Shift:=xlDown
If Sheet1.Range("A1") = "Rain" Then
Sheet2.Select
ElseIf Sheet1.Range("A1") = "Temp" Then
Sheet3.Select
ElseIf Sheet1.Range("A1") = "Part" Then
Sheet4.Select
Else: MsgBox "Error! Please restart the system."
End If
Set vType = ActiveSheet.Cells("1", "A")
Set vCellc = ActiveSheet.Cells("1", "C")
Set vCur6 = Sheet6.Cells(1, "A")
Set vType6 = Sheet6.Cells(1, "B")
vCur6.Value = vCellc.Value
vType6.Value = vType.Value
End Sub
And also i will include the final piece of the weather system that records data and now will show data between 2 dates on a graph, all from the forms menu.
Bookmarks