![]() |
Copy and Paste Loop
I have a problem here and my head hurts in figuring this out. Up to now, I'm still a newbie when it comes to VB macro programming. There's just too many object and command for me to read before I can learn all these. This may be challenging, easy for some but very hard for me. I need a macro that will search from A1 to A1000 and look for blanks in that row. once it find that blank cell, it needs to copy that row, starting from B to K and paste it in a row before that blank cells but it needs to paste it in column L and if theres still blank after that one, it needs to paste the succeeding rows in still the row before the blanks and this time it needs to be paste in column W This is really hard for me. Can someone help please? :( -- japorms ------------------------------------------------------------------------ japorms's Profile: http://www.excelforum.com/member.php...fo&userid=6544 View this thread: http://www.excelforum.com/showthread...hreadid=562970 |
Copy and Paste Loop
Sub FixRows()
lastrow = Cells(Rows.Count, "B").End(xlUp).Row baserow = 1 For i = 2 To lastrow If Len(Trim(Cells(i, 1))) < 0 Then baserow = i cnt = 0 Else With Cells(i, 2).Resize(1, 9) .Copy Destination:= _ Cells(baserow, "K").Offset(0, cnt * 12) .ClearContents End With cnt = cnt + 1 End If Next On Error Resume Next Set rng = Columns(1).SpecialCells( _ xlBlanks).EntireRow.Delete End Sub Test it on a copy of your data. -- Regards, Tom Ogilvy "japorms" wrote: I have a problem here and my head hurts in figuring this out. Up to now, I'm still a newbie when it comes to VB macro programming. There's just too many object and command for me to read before I can learn all these. This may be challenging, easy for some but very hard for me. I need a macro that will search from A1 to A1000 and look for blanks in that row. once it find that blank cell, it needs to copy that row, starting from B to K and paste it in a row before that blank cells but it needs to paste it in column L and if theres still blank after that one, it needs to paste the succeeding rows in still the row before the blanks and this time it needs to be paste in column W This is really hard for me. Can someone help please? :( -- japorms ------------------------------------------------------------------------ japorms's Profile: http://www.excelforum.com/member.php...fo&userid=6544 View this thread: http://www.excelforum.com/showthread...hreadid=562970 |
Copy and Paste Loop
Thanks a bunch Tom you're my savior :) Hopefully, I'll start learning more of these. :cool: -- japorms ------------------------------------------------------------------------ japorms's Profile: http://www.excelforum.com/member.php...fo&userid=6544 View this thread: http://www.excelforum.com/showthread...hreadid=562970 |
All times are GMT +1. The time now is 08:37 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com