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

No, there was a typo in my code. This is what it should say

With Worksheets("Sheet1")
iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow
If .Cells(i, "A").Value = "CCC" Then
iNextRow = iNextRow + 1
.Rows(i).Copy Worksheets("Sheet2").Cells(iNextRow, "A")
End If
Next i
End With


--
HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Robert" wrote in message
oups.com...
Hi Bob,

Thanks a lot for the promt assistance!
When running the statement I get an error for .Rows(i).Copy
Worksheets("Sheet2").Cells(INextrRow,"A")
Can it be that you have to include some sort of offset function to
paste the first line in say A1 and for the following lines something
like End(xldown).Offset(1, 0).Select?
Thanks again
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
How to modify specific lines in a .ini file? Jim[_13_] Excel Discussion (Misc queries) 2 January 30th 10 08:35 PM
printing specific lines Jim Office Supply Store Owner Excel Discussion (Misc queries) 1 October 10th 08 11:42 PM
How do I get page down to move a specific # of lines in Excel? Botswana92 Excel Worksheet Functions 1 December 19th 07 02:00 PM
Detect lines in specific sheet at load time ladyhawke Excel Programming 10 September 1st 06 07:25 AM
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 05:26 PM.

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"