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
 

Some videos you may like

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Tom Urtis

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,222
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
 

Watch MrExcel Video

Forum statistics

Threads
1,118,029
Messages
5,569,747
Members
412,289
Latest member
Kingchaos64
Top