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

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
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
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,917
Members
449,093
Latest member
dbomb1414

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