GirishDhruva
Active Member
- Joined
- Mar 26, 2019
- Messages
- 308
Hi everyone,
Here i am trying with this code for copying the values which are present in column 'B' based on column 'H' ,i have tried with the below code but it takes me lot of time , if i have huge data in my sheet, it goes to Excel-Not Responding State
Is their any other possible way to perform this
Here My main goal is to copy the values of column B that are present in between the values of column 'H' and paste that in another sheet
[TABLE="width: 500"]
<tbody>[TR]
[TD]Slno[/TD]
[TD]Column B[/TD]
[TD]...[/TD]
[TD]Column H[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]111[/TD]
[TD][/TD]
[TD]1212[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]222[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]333[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]444[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]555[/TD]
[TD][/TD]
[TD]12345[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]666[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]777[/TD]
[TD][/TD]
[TD]12333[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]888[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]999[/TD]
[TD][/TD]
[TD]12312[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]1000[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Thanks in advance
Here i am trying with this code for copying the values which are present in column 'B' based on column 'H' ,i have tried with the below code but it takes me lot of time , if i have huge data in my sheet, it goes to Excel-Not Responding State
Is their any other possible way to perform this
Here My main goal is to copy the values of column B that are present in between the values of column 'H' and paste that in another sheet
[TABLE="width: 500"]
<tbody>[TR]
[TD]Slno[/TD]
[TD]Column B[/TD]
[TD]...[/TD]
[TD]Column H[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]111[/TD]
[TD][/TD]
[TD]1212[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]222[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]333[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]444[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]555[/TD]
[TD][/TD]
[TD]12345[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]666[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]777[/TD]
[TD][/TD]
[TD]12333[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]888[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]999[/TD]
[TD][/TD]
[TD]12312[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]1000[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Code:
Sub looping()
Dim lastrow, i As Long
lastrow = Cells(Rows.Count, "H").End(xlUp).Row
For i = 2 To lastrow
If Cells(i, 8).Value = "" Then
Cells(i, 2).Copy
Worksheets("Sheet2").Select
Worksheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Select
Worksheets("Sheet2").Paste
Worksheets("Sheet1").Select
End If
Next i
End Sub
Thanks in advance