copy values if they are less then 1.67

amna77

Active Member
Joined
May 9, 2002
Messages
251
Hi, i have these following codes in the module. what they are for is they are looking value in column V, if value is less then 1.67 then it copyies the whoe row and paste that into sheet A. which is doing fine. my values are in negitive numbers as well, like -0.27 etc. now the thing is with my these following codes, it copies the empty rows as well. What i want to do is, if there is no value in column V then dont copy, onlu copy if value is less then 1.67.
can some one help me please. thanks in advance.




Sheets("ISRDATA").Select
' Find the last row of data
FinalRow = Range("A65536").End(xlUp).Row
' Loop through each row
For x = 16 To FinalRow
' Decide if to copy based on column V
thisvalue = Range("V" & x).Value
If thisvalue < 1.67 Then
Range("A" & x & ":AL" & x).Copy
Sheets("a").Select
NextRow = Range("A65536").End(xlUp).Row + 1
Range("A" & NextRow).Select
ActiveSheet.Paste
Sheets("ISRDATA").Select


End If
Next x
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Tom Urtis

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,270
amna77 said:
if there is no value in column V then dont copy
Maybe this, with my added code in bold:


Sheets("ISRDATA").Select
' Find the last row of data
FinalRow = Range("A65536").End(xlUp).Row
' Loop through each row
For x = 16 To FinalRow

'Decide if there is a value in the column V cell
If Len(Cells(x, 22).Value) > 0 Then


' Decide if to copy based on column V
thisvalue = Range("V" & x).Value
If thisvalue < 1.67 Then
Range("A" & x & ":AL" & x).Copy
Sheets("a").Select
NextRow = Range("A65536").End(xlUp).Row + 1
Range("A" & NextRow).Select
ActiveSheet.Paste
Sheets("ISRDATA").Select

'Put in an End If for the evaluation of the column V cell
End If



'Presumably in your code, down here somewhere is
Next x
 

amna77

Active Member
Joined
May 9, 2002
Messages
251
Thanks for help, it is working for me now.
Once again, thanks very much
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,111
Messages
5,835,450
Members
430,357
Latest member
Greshapa

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
Top