farhan11941234
New Member
- Joined
- Dec 14, 2019
- Messages
- 29
- Office Version
- 365
- Platform
- Windows
There are 9,000 Rows in my Data, this sub is taking too long.if there is any other way to do the same with VBA
VBA Code:
Sub combinedata()
Application.EnableEvents = False
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim lc As Long
Dim bilastrow As Long
Dim x, y As Long
s4lastrow = Sheet4.Cells(Rows.Count, 1).End(xlUp).Row
s3lastrow = Sheet3.Cells(Rows.Count, 1).End(xlUp).Row
For x = 2 To s4lastrow
For y = 2 To s3lastrow
If Sheet4.Cells(x, 1).Value = Sheet3.Cells(y, 1).Value Then
Sheet4.Cells(x, 8).Value = Sheet3.Cells(y, 5).Value
Sheet4.Cells(x, 9).Value = Sheet3.Cells(y, 2).Value
Sheet4.Cells(x, 10).Value = Sheet3.Cells(y, 3).Value
Sheet4.Cells(x, 11).Value = Sheet3.Cells(y, 4).Value
Sheet4.Cells(x, 12).Value = Sheet3.Cells(y, 6).Value
End If
Next y
Next x
Application.EnableEvents = True
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub