ukstallion
New Member
- Joined
- Sep 24, 2015
- Messages
- 2
Hi Guys! First timer here and really need some assistance in solving what maybe a simple issue. Background, I have a code that searches through a worksheet column (C), for the value within a 'UserForm' 'ListBox'. Once found, it adds a selection of additional 'TextBox' Values to the adjacent cells in the same row. However, I would then like to move the row to another row based upon one of the additional 'TextBox' values.
The below section of code, finds the value of a Trip ID# (ListBox23) and adds the Vehicle License Plate# (ListBox24), Driver (TextBox25) and Route Number (TextBox26) to the applicable cells in the same row.
'find the row to edit
Set findvalue = Worksheets("Data").Range("C:C"). _
Find(What:=Me.TextBox23.value, LookIn:=xlValues, LookAt:=xlWhole)
'update the values in Worksheet
findvalue = TextBox23.value
findvalue.Offset(0, 1) = TextBox24.value
findvalue.Offset(0, 2) = TextBox25.value
findvalue.Offset(0, 3) = TextBox26.value
To clarify, the below worksheet table shows a Schedule for individual Trips being made by two vehicles (A123456 & A123456. The 'UserForm' code, initial searches the schedule for the 'Trip ID#', then assigns the cells values accordingly.
The second option for the user is to update currently scheduled trips with new information. So for example, if Trip ID 'T123456' is no longer being competed by Vehicle 'A' but rather 'B' I need the code to delete the whole Row from under License# 'A123456' and insert it as a new Row of License# 'B123456' (So the other rows are simply moved down).
<tbody>
</tbody>
I would greatly appreciate any assistance you could provide, thanks.
The below section of code, finds the value of a Trip ID# (ListBox23) and adds the Vehicle License Plate# (ListBox24), Driver (TextBox25) and Route Number (TextBox26) to the applicable cells in the same row.
'find the row to edit
Set findvalue = Worksheets("Data").Range("C:C"). _
Find(What:=Me.TextBox23.value, LookIn:=xlValues, LookAt:=xlWhole)
'update the values in Worksheet
findvalue = TextBox23.value
findvalue.Offset(0, 1) = TextBox24.value
findvalue.Offset(0, 2) = TextBox25.value
findvalue.Offset(0, 3) = TextBox26.value
To clarify, the below worksheet table shows a Schedule for individual Trips being made by two vehicles (A123456 & A123456. The 'UserForm' code, initial searches the schedule for the 'Trip ID#', then assigns the cells values accordingly.
The second option for the user is to update currently scheduled trips with new information. So for example, if Trip ID 'T123456' is no longer being competed by Vehicle 'A' but rather 'B' I need the code to delete the whole Row from under License# 'A123456' and insert it as a new Row of License# 'B123456' (So the other rows are simply moved down).
License# | Trip ID# | Driver | Route# |
A123456 | T123456 | Smith | A001 |
T789123 | Jones | A002 | |
T456789 | Taylor | A002 | |
B123456 | T321456 | Smith | A003 |
T654789 | Jones | A004 | |
T987654 | Taylor | A004 | |
<tbody>
</tbody>
I would greatly appreciate any assistance you could provide, thanks.