Navi_G
Board Regular
- Joined
- May 30, 2018
- Messages
- 94
- Office Version
- 2016
- Platform
- Windows
Hi Experts,
I design a VBA code to search multiple items in my range (A2:D100) when I write cut # in (I2) the data against that cut could copy and paste in Range (A5:L100) in empty cell and at the last the curser should come in range (i2). my code is running without any error its curser come in Range (I2) but is not coping and pasting data pls some one check my code and correct it.
Report.xlsm
Thanks in advance.
Regards,
Navi_G
I design a VBA code to search multiple items in my range (A2:D100) when I write cut # in (I2) the data against that cut could copy and paste in Range (A5:L100) in empty cell and at the last the curser should come in range (i2). my code is running without any error its curser come in Range (I2) but is not coping and pasting data pls some one check my code and correct it.
Report.xlsm
VBA Code:
Sub Button3_Click()
Application.ScreenUpdating = False
Dim x As String
Dim y As Integer
Dim Z As Integer
Range("i5:i100").ClearContents
x = Sheet1.Range("i2").Value
y = Sheet1.Range("a100").End(xlUp).Row
For Z = 2 To y
If Cells(Z, 1) = x Then
Range(Cells(Z, 1), Cells(Z, 5)).Copy
Range("i100").End(xlUp).Offset(1, 0).PasteSpecial xlPasteFormulasAndNumberFormats
End If
Next Z
Application.CutCopyMode = False
Range("i2").Select
End Sub
Thanks in advance.
Regards,
Navi_G