change a form from input new data to edit existing data

glossy001

New Member
Joined
Sep 18, 2014
Messages
13
can any body help to change this form which works perfectly for inputting new data into a spread sheet to being able to edit the existing data in the spread sheet,scroll through the spread sheet to check existing data and still be able to add new data.
Many thanks in advance.

Private Sub CmdBtnEnterData_Click()

'Dim RowCount As 0
Dim RowCount As Long
Dim ctl As Control

'check user input if no input show message box
Select Case True

'removed this piece of code when adding the calendar control
'Case Me.TxtBxDate.Value = ""
'MsgBox "please enter the date"
'Me.TxtBxDate.SetFocus

Case Me.TxtBxInfo.Value = ""
MsgBox "Please insert the details of the task as completed "
Me.TxtBxInfo.SetFocus


Case Me.CmboBxSite.Value = ""
MsgBox "Insert details of your location when the task was completed "
Me.CmboBxSite.SetFocus


Case Me.CmboBxProjTitle.Value = ""
MsgBox "Insert a project title for the task "
Me.CmboBxProjTitle.SetFocus

Case Me.CmboBxJob.Value = ""
MsgBox "what sort of work was this "
Me.CmboBxJob.SetFocus


Case Me.CmboBxServiceObj.Value = ""
MsgBox "The service objective this task falls under "
Me.CmboBxServiceObj.SetFocus


'CmboBxObjectives
Case Me.CmboBxObjectives.Value = ""
MsgBox "Description "
Me.CmboBxObjectives.SetFocus




'CmboBxActionSteps
Case Me.CmboBxActionSteps.Value = ""
MsgBox "add the steps taken to achieve this objective "
Me.CmboBxActionSteps.SetFocus


'CmboBxExpPerform
Case Me.CmboBxExpPerform.Value = ""
MsgBox "Performance value "
Me.CmboBxExpPerform.SetFocus

'supporting documentation box not neccessary to check the input
'TxtBxSupportDoc
'Case Me.TxtBxSupportDoc.Value = ""
'MsgBox "Add any supporting documentation "
'Me.TxtBxSupportDoc.SetFocus


Case Else
'Entries validated
'note the space on the end of Data
With Worksheets("Data ").Range("A" & Rows.Count).End(xlUp)

.Offset(1, 0).Value = Me.Calendar.Value
.Offset(1, 1).Value = Me.TxtBxInfo.Value
.Offset(1, 2).Value = Me.CmboBxSite.Value
.Offset(1, 3).Value = Me.CmboBxProjTitle.Value
.Offset(1, 4).Value = Me.CmboBxJob.Value
.Offset(1, 5).Value = Me.CmboBxServiceObj.Value
.Offset(1, 6).Value = Me.CmboBxObjectives.Value
.Offset(1, 7).Value = Me.CmboBxActionSteps.Value
.Offset(1, 8).Value = Me.CmboBxExpPerform.Value
.Offset(1, 9).Value = Me.CmboBxExceedPer.Value
.Offset(1, 10).Value = Me.TxtBxSupportDoc.Value
End With

'clear the form

For Each ctl In Me.Controls
If TypeName(ctl) = "TextBox" Or TypeName(ctl) = "ComboBox" Then ctl.Value = ""
Next ctl

End Select

End Sub
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,214,596
Messages
6,120,438
Members
448,966
Latest member
DannyC96

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