kelly mort
Well-known Member
- Joined
- Apr 10, 2017
- Messages
- 2,169
- Office Version
- 2016
- Platform
- Windows
So, my goal is to edit all three sheets at a time, for the items in a given column. There are three sheets in all that are loaded into the combobox. “Round 1”, “Round 2”, “Round 3”. Each time I run the code below, there is one of the sheets active in the combobox. I have this variable called, MyEnterValue, which is loaded when I click my listbox – used this trick because using the actual enter value was creating issues especially after the original value has been altered and I enter it again. Using the listbox click event seemed to be the coolest way I came about. So when I run this code to edit the current selected sheet, I will check if MyEnterValue is not equal to the value in txt2. So when they are not equal, then I loop through column C of the other two sheets, which I don’t know how best to identify them ATM, to see if there is an item in each of them that matches the MyEnterValue variable content. If there is, then I update that value with the content of the txt2 textbox. I am stacked with the coolest logic and I need tech support. Thanks for your time and help in advance.
Code:
Sub EditAllSheets()
Dim MyRound$, findvalue As Range, i&
MyRound = Me.ComboBox1.Text
With Sheets(MyRound)
Set findvalue = .[B7:B107].Find(what:=txt1.Text, LookIn:=xlValues, lookat:=xlWhole)
For i = 1 To 5
findvalue.Offset(, i) = Trim(Controls("txt" & i + 1).Value)
Next i
End With
End Sub