Next/Previous

seasmith

New Member
Joined
Jul 6, 2011
Messages
44
I have a pop up form with multiple text boxes to enter the information when I click the next button the information that is entered goes into the next blank row. This is the code that I have:

Private Sub cmdNext_Click()
'.End(xlUp) is the same as Ctrl-Up which finds the last non emtpy row and then (1,#) offsets it by one so so it is put down 1 row and over however many rows'
Range("A" & Rows.Count).End(xlUp).Offset(1).Value = txtrelief.Text 'Finds first empty row in column A and enters the relief #'
Range("A" & Rows.Count).End(xlUp)(1, 2) = txtlocation.Text 'Enters the location in the second column'
Range("A" & Rows.Count).End(xlUp)(1, 3) = txtcompressor.Text
Range("A" & Rows.Count).End(xlUp)(1, 4) = txtsub.Text
Range("A" & Rows.Count).End(xlUp)(1, 5) = cbomanu.Text
Range("A" & Rows.Count).End(xlUp)(1, 6) = txtmodel.Text
Range("A" & Rows.Count).End(xlUp)(1, 7) = txtsetting.Text
Me.Hide 'Closes the first form'
Load frmAdd_Relief2 'Opens the second form'
frmAdd_Relief2.Show
Unload Me 'Clears the form so it is blank each time it is opened'
End Sub


On the next page of the form there is a previous button and the code is:
Private Sub cmdPrevious_Click()
Me.Hide 'Closes the second form'
Load frmAdd_Relief1 'Goes back to the first form'
frmAdd_Relief1.Show
End Sub

The problem is that if I click the previous button to go back to the first form, and change a piece of information and click the next button all of the information goes into the next blank row instead of just changing the bit of information that I changed. I feel like there is a quick fix for this but I'm not quite sure what it is.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top