Copy row from one Excel sheet to another in same workbook - add below do not replace

seider

New Member
Joined
Nov 23, 2017
Messages
6
Dear Friends of Excel,

I have a issue I hope that you can help me with.

I have 2 sheets in a workbook - one called ("2. Identification") another called ("4. Main opportunities").

I found below code to copy all the rows marked with "Yes" from ("2. Identification") to ("4. Main opportunities").

Its working fine, the issue is that when i run the macro is it replacing the text. I would like it to add it below a already inserted row. Can you help adding that possibility to the code?

Have tried to search in the forum with no luck.

Please let me know if you want any further clarifications.

seider

Code:
Sub CopyROW()

Set I = Sheets("2. Identification")
Set e = Sheets("4. Main opportunities")
Dim d
Dim j
d = 1
j = 2

Do Until IsEmpty(I.Range("K" & j))

If I.Range("K" & j) = "Yes" Then
d = d + 1
e.Rows(d).Value = I.Rows(j).Value

End If
j = j + 1
Loop
End Sub
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top