petaaalouise
New Member
- Joined
- Apr 23, 2015
- Messages
- 23
Hi,
I have a userform which updates specific data in my sheets. I have a code that updates the data but will only update one of the sheets(Usually the closed to the master).
Also the code is written to not update the "Master"
I'll post the code. Ant help would be greatly appreciated.
Private Sub CommandButton4_Click()
Dim lst As Range
Dim i As Long
For i = 1 To ThisWorkbook.Sheets.Count
If Sheets(i).Name <> "Master" Then Sheets(i).Select Replace:=False
Next i
With Sheets
Set lst = Range("B:B")
Set lst = lst.Find(What:=Me.TextBox1.Value, After:=Range("B11"), LookAt:=xlWhole)
If lst Is Nothing Then
Me.TextBox1.SetFocus
Exit Sub
Else: lst.Offset(0, 1).Value = Me.TextBox2.Value
End If
End With
MsgBox "You have successfully updated Transmittal. "
Unload Me
Call UserForm_Initialize
End Sub
I have a userform which updates specific data in my sheets. I have a code that updates the data but will only update one of the sheets(Usually the closed to the master).
Also the code is written to not update the "Master"
I'll post the code. Ant help would be greatly appreciated.
Private Sub CommandButton4_Click()
Dim lst As Range
Dim i As Long
For i = 1 To ThisWorkbook.Sheets.Count
If Sheets(i).Name <> "Master" Then Sheets(i).Select Replace:=False
Next i
With Sheets
Set lst = Range("B:B")
Set lst = lst.Find(What:=Me.TextBox1.Value, After:=Range("B11"), LookAt:=xlWhole)
If lst Is Nothing Then
Me.TextBox1.SetFocus
Exit Sub
Else: lst.Offset(0, 1).Value = Me.TextBox2.Value
End If
End With
MsgBox "You have successfully updated Transmittal. "
Unload Me
Call UserForm_Initialize
End Sub