LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Code copies between key word is in reverse order

Try:

Sub Test2()

Dim strStart As String

Dim strEnd As String

Dim RStart As Range

Dim REnd As Range

Dim LRow As Long

Dim i As Long



strStart = "XX"

strEnd = "XXX"

i = 1



LRow = Cells(Rows.Count, 1).End(xlUp).Row

Do

Set RStart = Range(Cells(i, 1), Cells(LRow, 1)).Find _

(strStart, Cells(LRow, 1), xlValues, xlWhole)

If Not RStart Is Nothing Then

Set REnd = Range(Cells(i, 1), Cells(LRow, 1)).Find _

(strEnd, Cells(RStart.Row, 1), xlValues, xlWhole)

Range(RStart.Offset(1, 0), REnd.Offset(-1, 0)).Copy

Range("B" & Rows.Count).End(xlUp).Offset(2, 0) _

.PasteSpecial xlPasteValues

i = REnd.Row

End If

Loop While i < LRow And Not RStart Is Nothing

End Sub


Regards

Claus B.



Very nice! As always, thanks Claus.

Regards,
Howard
 
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
Reverse Row Order? trvlnmny New Users to Excel 3 May 30th 10 08:22 AM
Reverse name order xp Excel Programming 4 August 12th 09 07:27 PM
Reverse Order PL Excel Discussion (Misc queries) 1 June 17th 09 02:47 AM
Reverse Order PL Excel Discussion (Misc queries) 2 June 15th 09 09:17 AM
reverse order Lamb Chop Excel Discussion (Misc queries) 2 June 20th 06 03:37 PM


All times are GMT +1. The time now is 05:59 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"