View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Stuart[_3_] Stuart[_3_] is offline
external usenet poster
 
Posts: 50
Default Macro to copy and paste all rows of data in between two words

Mike

Thanks for your reply.

Do you happen to know how I can add the following formula into the
last column of data?

="DATA"&" - "&B8&" - "&C8&"

I want to add the above formula into the last column where there are
rows containing text in the first cell of that row.

I appreciate that this is a rather complicated request but I was
hoping that someone on the forum would be able to assist.

Kind Regards,

Stuart


On Apr 22, 12:14*pm, Mike H wrote:
Stuart,

try this

Sub CopyData()
Set srcSht = Sheets("Datafrom")
Set dstSht = Sheets("Datato")
Dim lastrow As Long
Dim StRow As Range
Dim EndRow As Range
Set StRow = srcSht.Range("B:B").Find("Start", LookIn:=xlValues,
lookat:=xlWhole)
Set EndRow = srcSht.Range("B:B").Find("End", LookIn:=xlValues,
lookat:=xlWhole)
If StRow Is Nothing Or EndRow Is Nothing Then
* * MsgBox "Range Not Found"
* * * * Exit Sub
End If
* * lastrow = dstSht.Cells(Cells.Rows.Count, "A").End(xlUp).Row + 1
* * srcSht.Rows(StRow.Row & ":" & EndRow.Row).Copy
Destination:=dstSht.Range("A" & lastrow)
End Sub

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.



"Stuart" wrote:
Dear Group


This is probably somewhere here on this site but I cannot seem to
track it down so I hope someone can help me.


I am looking for a macro that can find the word "Start" in column B
and then move one row and select all the rows until the word "End" is
found in Column B".


Then copy from sheet named "Datafrom" to sheet named "Datato".


I really hope someone can help with this.


Thanks very much in advance.
.