VBA Code To Move Row Worksheet Rows based upon 'FindVlaue' criteria from User Form

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).

License#Trip ID#DriverRoute#
A123456T123456SmithA001
T789123JonesA002
T456789TaylorA002
B123456T321456
SmithA003
T654789
JonesA004
T987654
TaylorA004

<tbody>
</tbody>
















I would greatly appreciate any assistance you could provide, thanks.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,214,983
Messages
6,122,595
Members
449,089
Latest member
Motoracer88

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