Hi all,
Code below simply updates all cells with values of the textbox/combobox. It doesn’t matter if I change the values or not, it will simply paste all 23 boxes again. This operation takes around 45 seconds as I have lots of formulations in over 30 pages linked to the database.
I need a code where, if a box hasn’t been edited, then there’s no point pasting it’s data again etc.
i.e
OPERATION 1) If textbox26 changed Then
ActiveCell.Offset(0, 0).Value = TextBox26.Value
OPERATION 2) if combobox19 changed Then
ActiveCell.Offset(0, -1).Value =
ComboBox19.Value
Etc.etc. The code should check for all 23 boxes and only paste boxes that have been edited.
This is the code:
Code below simply updates all cells with values of the textbox/combobox. It doesn’t matter if I change the values or not, it will simply paste all 23 boxes again. This operation takes around 45 seconds as I have lots of formulations in over 30 pages linked to the database.
I need a code where, if a box hasn’t been edited, then there’s no point pasting it’s data again etc.
i.e
OPERATION 1) If textbox26 changed Then
ActiveCell.Offset(0, 0).Value = TextBox26.Value
OPERATION 2) if combobox19 changed Then
ActiveCell.Offset(0, -1).Value =
ComboBox19.Value
Etc.etc. The code should check for all 23 boxes and only paste boxes that have been edited.
This is the code:
Code:
Private Sub Submitbutton_Click()
Dim FindString As String
Dim Rng As Range
FindString = Range("e11").Value
If Trim(FindString) <> "" Then
With Sheets("manager 1").Range("f:f")
Set Rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Application.ScreenUpdating = False
Application.Goto Rng, False
ActiveCell.Offset(0, 0).Value = TextBox26.Value 'name
ActiveCell.Offset(0, -5).Value = ComboBox19.Value 'store
ActiveCell.Offset(0, -1).Value = TextBox24.Value 'position
ActiveCell.Offset(0, 1).Value = TextBox23.Value 'hire date
ActiveCell.Offset(0, 2).Value = TextBox22.Value 'current role start date
ActiveCell.Offset(0, 3).Value = TextBox21.Value 'function start date
ActiveCell.Offset(0, 4).Value = TextBox36.Value 'status
ActiveCell.Offset(0, 5).Value = TextBox46.Value 'status start date
ActiveCell.Offset(0, 6).Value = TextBox56.Value 'salary
ActiveCell.Offset(0, 7).Value = TextBox66.Value 'review grade
ActiveCell.Offset(0, 9).Value = TextBox76.Value 'ly review grade
ActiveCell.Offset(0, 8).Value = TextBox86.Value 'potential scope
ActiveCell.Offset(0, 10).Value = TextBox96.Value 'ly potential scope
ActiveCell.Offset(0, 11).Value = TextBox12.Value
ActiveCell.Offset(0, 12).Value = TextBox13.Value
ActiveCell.Offset(0, 13).Value = TextBox14.Value
ActiveCell.Offset(0, 14).Value = TextBox15.Value 'mother tongue
ActiveCell.Offset(0, 15).Value = TextBox16.Value 'additional lang 1
ActiveCell.Offset(0, 16).Value = TextBox18.Value 'additional lang 2
ActiveCell.Offset(0, 17).Value = TextBox19.Value 'additional lang 3
ActiveCell.Offset(0, 18).Value = TextBox20.Value 'secondment
ActiveCell.Offset(0, 19).Value = TextBox31.Value 'length of secondment
ActiveCell.Offset(0, 20).Value = TextBox32.Value 'relocation 1
ActiveCell.Offset(0, 21).Value = TextBox33.Value 'relocation 2
ActiveCell.Offset(0, 22).Value = TextBox43.Value
ActiveCell.Offset(0, 23).Value = TextBox54.Value
Sheets("One-Pager Profile").Select
Range("A1").Select
Unload Me
'MsgBox "Comment Saved"
Else
MsgBox "Nothing found"
End If
End With
End If
End Sub