Find rows containing data and copy to next blank row

Woody75

Board Regular
Joined
Feb 26, 2012
Messages
114
Hi all,

Does anyone have a macro that will do the following??

In table 1 you will see that not all rows contain data (this is because i have removed it previously with a macro) the second table shows what i want the macro to do but without deleting rows:

AHiddenrow with formulaBCDEHiddenrow with formulaF
1Order NoHiddenNameAddress 1Address 2Post CodeHiddenDispatched
2
312345Smith10 The PlaceLONDONSW1 1SWNo
4
598765Jones9 The PlaceMancsM15 6THNo
6
745678BrownBlah blahBlahBlahNo

<tbody>
</tbody>






AHiddenrow with formulaBCDEHiddenrow with formulaF
1Order NoHiddenNameAddress 1Address 2Post CodeHiddenDispatched
212345Smith10 The PlaceLONDONSW1 1SWNo
398765Jones9 The PlaceMancsM15 6THNo
445678BrownBlah blahBlahBlahNo
5
6

<tbody>
</tbody>






So basically i would like a macro to search for the first none blank value in column A and copy the row to the first available blank row , it also needs to blank out that row once done. i.e row 3 would be moved up to row 2, 5 up to 3, 7 up to 4 etc etc.

The hidden rows contain formulas which cannot be deleted or my ws goes Pete Tongue.

Many Thanks

Woody
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
The hidden rows contain formulas which cannot be deleted or my ws goes Pete Tongue.

Can post those formulas? Someone may be able to help make them more robust to row deletions.
 
Upvote 0
Can post those formulas? Someone may be able to help make them more robust to row deletions.

I just used the tables above as examples, the actual formulas as per my ws are as follows:

Cell E3:E3002 =IF(D3="","",MONTH(D3)) - calculates month from date in D10, which is then compared to the month of =Today() - this is used to sort data being shown in a sep ws.

Cells M3:M3002 =IF(F3="","",IF(L3>0,"YES","NO")) - basic If cmd that tells other ws whether that line of info has been dealt with. This links into the same 'other' ws mentioned above to filter results.

Cheers
 
Last edited:
Upvote 0
These don't look vulnerable to row deletions - maybe the formula in the "other" worksheet are causing the problem?
 
Upvote 0
Agreed, but I would like the number of rows to remain constant, the only thing I need the macro to do is find the first Non-Blank Value of column A (Top to Bottom) and paste the row info from column A?:K? in the first blank row. It would then need to loop through both actions until completed.
 
Upvote 0
Is there a column that you can sort on to move the blank rows to the bottom?
 
Upvote 0
Is there a column that you can sort on to move the blank rows to the bottom?

Hmmm, hadn't thought of that... ;) the columns do indeed have an autofilter, but the first column (A) is numbered 1 to 3000, and i'd like to keep it that way.

whats the best way to apply an autofilter to say Range B2:G3002 but only filter by column F to get the blanks at the bottom?
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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