Ho la necessità di copiare dal foglio Master tutte le righe che, nella cella della colonna G, contengono parte del testo presente nella TextBoxnome, e accodarle nel foglio Controllo.
Ho creato una macro, ma non mi funziona:
- Codice: Seleziona tutto
Sub copia()
Dim sh1 As Worksheet, sh2 As Worksheet
Dim ur As Long, ur2 As Long
Dim x As Integer
Dim y As Long
Application.ScreenUpdating = False
Set sh1 = Worksheets("Master")
Set sh2 = Worksheets("Controllo")
With sh1
ur = .Cells(Rows.Count, 7).End(xlUp).End(xlUp).Row
x = sh2.Cells(Rows.Count, 7).End(xlUp).End(xlUp).Row
For y = 1 To ur
If UserForm1.TextBoxnome.Text Like "*" & .Cells(y, 7) & "*" Then
.Range("A" & y & ":" & "AE" & y).Copy
sh2.Range("A" & x & ":" & "AE" & x).PasteSpecial Paste:=xlValues
End If
Next
End With
Application.CutCopyMode = False
Application.ScreenUpdating = True
Set sh1 = Nothing
Set sh2 = Nothing
End Sub
Qualcuno sa dirmi dove sto sbagliando?
Grazie