I currently use the following code to move up one question in a spreadsheet that I'm doing; Problem is that it actually keeps the last answer. I actually want to delete the last Excel Row when the Prev Button is pressed. How Can I delete the last row on an excel worksheet?
Code:
Private Sub CmdPrevQuestion_Click()
If m_QID = 1 Then
m_QID = 1
CmdPrevQuestion.Enabled = False
Else
m_QID = QID_Prev(m_Question)
Call Question_Load
CmdPrevQuestion.Enabled = True
End If
End Sub
'This will return to Last question
Function QID_Prev(Question As String) As Integer
QID_Prev = 0
On Error Resume Next
QID_Prev = Application.WorksheetFunction.Match(Question, shOutput.Range("$B$1:$B$5000"), 0) - 1
If QID_Prev = 0 Then QID_Prev = Application.CountA(shOutput.Columns(1))
QID_Prev = CInt(shOutput.Range("A" & QID_Prev).Value)
End Function