Copy entire row from one tab into another

Closed
celnow - Sep 8, 2008 at 01:10 PM
 Jia - Apr 16, 2010 at 12:07 AM
Hello,
I'm trying to automate a process where I copy an entire row after a certain condition in a cell is met into another worksheet/ tab. Also after the row has been copied I would like to delete the row in the first worksheet/tab. I tried to use macros but they copy my hidden cells as well. I guess I have to write a code, but need your help for this... I hope this makes sense...

Many Thanks
Christian
Related:

1 response

Ivan-hoe Posts 433 Registration date Saturday February 16, 2008 Status Member Last seen October 17, 2008 110
Sep 9, 2008 at 02:35 AM
Hello Christian,
Please copy here the macros you used and afterwards we'll try to see what goes wrong in them.
Ivan
16
Hi Ivan,

I'm trying to do something almost exactly the same as Christian above, but I wouldn't want to delete the orginal line of data I'm copying from and I haven't begun to write a macro for it yet as I'm not very good with it. I've been looking for help for this one for some time now and haven't been able to get any. Can you help please?

Thanks!
0
Hi Ivan,

Here is my code. I am looking to search for a row in worksheet 2 corresponding to a value entered in worksheet 1. If the value matches, it will copy the rows to worksheet 1. So far I discovered that while debugging it does search right; but is unable to copy. Can you please help me?
Sub Value_Proposition_NewSearch()
'
' Value_Proposition_NewSearch Macro
'

'
Dim wksTarget As Worksheet, wksSource As Worksheet
Dim rngTarget As Range, rngSource As Range, rngID As Range
Dim iD As String
Set wksTarget = ThisWorkbook.Sheets("Menu")
Set wksSource = ThisWorkbook.Sheets("ValuePropositionData")
Set rngID = wksTarget.Range("a24")
'clear any old data on summary sheet
Set rngTarget = rngID.SpecialCells(xlCellTypeLastCell)
If rngTarget.Row > rngID.Row Then
wksTarget.Range(rngID.Offset(1), rngTarget).EntireRow.ClearContents
End If
'matching rows will get copied to summary sheet starting row 3
Set rngTarget = rngID.Offset(25)
'find matching rows on address sheet starting row 2
Set rngSource = wksSource.Range("a9")
iD = rngID.Value
Do Until (rngSource.Value = "")
If rngSource.Value = iD Then
Application.CutCopyMode = True
rngSource.EntireRow.Copy
wksTarget.Paste rngTarget
Application.CutCopyMode = False
Set rngTarget = rngTarget.Offset(1)
End If
Set rngSource = rngSource.Offset(1)
Loop
End Sub
0
What is the answer?
0