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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
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,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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