move row to sheet based on UserForm ComboBox value

elbazi

New Member
Joined
Jun 21, 2022
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi guys,

I am looking for VBA code to look in column A for a certain = ComboBox value and when finds to check row number, move it from sheet1 to sheet2
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Try this:

VBA Code:
Private Sub ComboBox1_Change()
  Dim f As Range
  
  If ComboBox1.ListIndex = -1 Then Exit Sub
  If ComboBox1.Value = "" Then Exit Sub
  
  Set f = Sheets("Sheet1").Range("A:A").Find(ComboBox1.Value, , xlValues, xlWhole, , , False)
  If Not f Is Nothing Then
    f.EntireRow.Copy Sheets("Sheet2").Range("A" & Sheets("Sheet2").Range("A" & Rows.Count).End(3).Row + 1)
    f.EntireRow.Delete
  Else
    MsgBox "Not exists"
  End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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