LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default VBA, copy lines with specific value

Hi All,

From an investment portfolio I am trying to exclude a certain asset
class (swaps)
My idea was to put a simple =IF() statement in column A that
identifies if it concerns a plain asset (result=0) or a swap asset
(result=1)
I defined the below VBA statement but when I run it all formulas
(=IF()) are deleted from column A and the results are paste as values.

'Exclude all Swaps
Dim iLastRow As Long, iNextRow As Long
Dim i As Long
With Worksheets("Positions")
iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow
Cells(i, "A").Value = "0"
iNextRow = iNextRow + 1
.Cells(i, "A").Resize(, 21).Copy _
Worksheets("Cut-Out").Cells(iNextRow, "A")
End If
Next i

End With


Can someone tell me what is wrong with this statement and how to
adjust it in order not delete the formulas in column A?

Many thanks!!!!!

Rgds,
Robert
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
printing specific lines Jim Office Supply Store Owner Excel Discussion (Misc queries) 1 October 10th 08 11:42 PM
Sub to copy only result lines within formula range, omit null string lines Max Excel Programming 2 July 15th 07 04:21 AM
Copy lines with specific value Robert[_30_] Excel Programming 3 July 11th 07 02:32 PM
VBA, copy lines with specific value Robert[_30_] Excel Programming 3 February 13th 07 12:57 PM
Print only lines that have a value in a specific colum Neve Setting up and Configuration of Excel 1 August 17th 05 12:31 AM


All times are GMT +1. The time now is 10:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"