Copy certain rows that have a certain value range in a column to a new worksheet

ambarish

New Member
Joined
Nov 8, 2012
Messages
2
Hi,

Could you please help me with a VBA code that would look at column M in sheet 1 and if any cells in column M =>10,000,000 then this entire row gets copied on another worksheet. Thanks so much for your help.

Ambarish
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Try this on a copy of your data as it is untested
Sub Copy()
Application.ScreenUpdating = False
Dim LR As Long, i As Long
LR = Range("M" & Rows.count).End(xlUp).Row
For i = LR To 1 Step -1
If Range("M" & i).Value => "10,000,000" Then Rows(i).Copy Destination:=Sheets("Sheet2").Cells(Rows.count, "A").End(xlUp).Offset(1)
End If
Next i
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thanks for your reply. I get an error message - Compile Error: (End if without block if). Could you please help? Thanks again.
 
Upvote 0

Forum statistics

Threads
1,215,453
Messages
6,124,930
Members
449,195
Latest member
Stevenciu

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