Copy Down (possibly fill) - VBA - until last populated row in sheet

Allan Walker

New Member
Joined
Jun 10, 2010
Messages
49
Hi,

I am trying to re-format a sheet.

I know how to delete empty rows by VBA, so I can clean this up after. I'd really appreciate some help...I think it involves xlup and fill, but can't for the life of me work the sub routine out.

Note: The number of rows in the sheet can vary, so the last date and name should only be copied down as far as the end of the last populated row.

I'm using Office 2003 on XPSP3

Before:


Excel Workbook
ABCDEFGH
1*******YASMIN AKHTAR (YA1)
2Mon 01 Aug 2011*******
3*06:00-06:30 AM*30mins*MARY COOK(PR271)**
4*06:45-07:30 AM*45mins*BETTY YATES(WD305)**
5*07:30-08:00 AM*30mins*JOAN OWEN(PR304)**
6*08:15-09:15 AM*1 hour*AVTAR SINGH(WD401)**
7*09:15-10:15 AM*1 hour*HILDA *YOUNG(WD405)**
8*11:45-12:15 Lunchtime*30mins*PERCY COLEMAN(WD410)**
9*12:15-12:45 Lunchtime*30mins*AUGUSTA BELL(WD273)**
10*12:45-13:15 Lunchtime*30mins*LILLIAN WOODLEY(WD301)**
11*13:15-13:45 Lunchtime*30mins*CHARLES BARRINGTON BATEMAN(WH2... * * * * * * * * * ***
12*13:45-14:15 Lunchtime*30mins*BETTY MASKELL(WH229)**
13*14:15-14:30 Lunchtime*15mins*VIOLET *LACEY(WH177)**
14*14:30-14:45 Lunchtime*15mins*ELIZABETH POWELL(WD203)**
15*14:45-15:00 Lunchtime*15mins*VIOLET BLOFELD(WH287091)**
16*15:00-15:15 Lunchtime*15mins*GRACE CORDERY(WH287175)**
17*15:15-16:00 AM*45mins*GWENDOLINE JOHNSON(WH287153) * * * * * * * * * * * * ***
18*18:00-18:15 PM*15mins*MARJORIE CALDWELL(PR281)**
19*18:15-18:30 PM*15mins*GWENDOLINE *WARE (WD334)**
20*18:30-19:00 PM*30mins*TAMARA JANSSENS(WK121)**
21*19:00-19:15 PM*15mins*MOHINDER AHLUWALIA(WK321)**
22*19:15-19:45 PM*30mins*VERA AXTELL(WD414)**
23*19:45-20:15 PM*30mins*JOAN MACE(WK406)**
24*20:15-20:45 PM*30mins*AVTAR SINGH(WD401)**
25******* * * * * * * * * * * * *
26*******YASMIN AKHTAR (YA1)
27Tue 02 Aug 2011*******
28*06:00-06:15 AM*15mins*AMALIA ATKINSON(WH287184)**
29*06:45-07:30 AM*45mins*BETTY YATES(WD305)**
30*07:30-08:00 AM*30mins*MARY COOK(PR271)**
31*08:15-09:15 AM*1 hour*AVTAR SINGH(WD401)**
32*09:15-10:15 AM*1 hour*HILDA *YOUNG(WD405)**
33*11:15-11:30 Lunchtime*15mins*VIOLET BLOFELD(WH287091)**
34*11:30-11:45 Lunchtime*15mins*ELIZABETH POWELL(WD203)**
35*12:00-12:30 Lunchtime*30mins*PERCY COLEMAN(WD410)**
36*12:30-13:00 Lunchtime*30mins*LILLIAN WOODLEY(WD301)**
37*13:15-13:45 Lunchtime*30mins*CHARLES BARRINGTON BATEMAN(WH2... * * * * * * * * * ***
38*13:45-14:15 Lunchtime*30mins*BETTY MASKELL(WH229)**
39*14:15-14:30 Lunchtime*15mins*VIOLET *LACEY(WH177)**
Sheet 1


After (the result I am after)


Excel Workbook
ABCDEFGH
3Mon 01 Aug 201106:00-06:30 AM*30mins*MARY COOK(PR271)*YASMIN AKHTAR (YA1)
4Mon 01 Aug 201106:45-07:30 AM*45mins*BETTY YATES(WD305)*YASMIN AKHTAR (YA1)
5Mon 01 Aug 201107:30-08:00 AM*30mins*JOAN OWEN(PR304)*YASMIN AKHTAR (YA1)
6Mon 01 Aug 201108:15-09:15 AM*1 hour*AVTAR SINGH(WD401)*YASMIN AKHTAR (YA1)
7Mon 01 Aug 201109:15-10:15 AM*1 hour*HILDA *YOUNG(WD405)*YASMIN AKHTAR (YA1)
8Mon 01 Aug 201111:45-12:15 Lunchtime*30mins*PERCY COLEMAN(WD410)*YASMIN AKHTAR (YA1)
9Mon 01 Aug 201112:15-12:45 Lunchtime*30mins*AUGUSTA BELL(WD273)*YASMIN AKHTAR (YA1)
10Mon 01 Aug 201112:45-13:15 Lunchtime*30mins*LILLIAN WOODLEY(WD301)*YASMIN AKHTAR (YA1)
11Mon 01 Aug 201113:15-13:45 Lunchtime*30mins*CHARLES BARRINGTON BATEMAN(WH2... * * * * * * * * * **YASMIN AKHTAR (YA1)
12Mon 01 Aug 201113:45-14:15 Lunchtime*30mins*BETTY MASKELL(WH229)*YASMIN AKHTAR (YA1)
13Mon 01 Aug 201114:15-14:30 Lunchtime*15mins*VIOLET *LACEY(WH177)*YASMIN AKHTAR (YA1)
14Mon 01 Aug 201114:30-14:45 Lunchtime*15mins*ELIZABETH POWELL(WD203)*YASMIN AKHTAR (YA1)
15Mon 01 Aug 201114:45-15:00 Lunchtime*15mins*VIOLET BLOFELD(WH287091)*YASMIN AKHTAR (YA1)
16Mon 01 Aug 201115:00-15:15 Lunchtime*15mins*GRACE CORDERY(WH287175)*YASMIN AKHTAR (YA1)
17Mon 01 Aug 201115:15-16:00 AM*45mins*GWENDOLINE JOHNSON(WH287153) * * * * * * * * * * * * **YASMIN AKHTAR (YA1)
18Mon 01 Aug 201118:00-18:15 PM*15mins*MARJORIE CALDWELL(PR281)*YASMIN AKHTAR (YA1)
19Mon 01 Aug 201118:15-18:30 PM*15mins*GWENDOLINE *WARE (WD334)*YASMIN AKHTAR (YA1)
20Mon 01 Aug 201118:30-19:00 PM*30mins*TAMARA JANSSENS(WK121)*YASMIN AKHTAR (YA1)
21Mon 01 Aug 201119:00-19:15 PM*15mins*MOHINDER AHLUWALIA(WK321)*YASMIN AKHTAR (YA1)
22Mon 01 Aug 201119:15-19:45 PM*30mins*VERA AXTELL(WD414)*YASMIN AKHTAR (YA1)
23Mon 01 Aug 201119:45-20:15 PM*30mins*JOAN MACE(WK406)*YASMIN AKHTAR (YA1)
24Mon 01 Aug 201120:15-20:45 PM*30mins*AVTAR SINGH(WD401)*YASMIN AKHTAR (YA1)
25******* * * * * * * * * * * * *
26********
27********
28Tue 02 Aug 201106:00-06:15 AM*15mins*AMALIA ATKINSON(WH287184)*YASMIN AKHTAR (YA1)
29Tue 02 Aug 201106:45-07:30 AM*45mins*BETTY YATES(WD305)*YASMIN AKHTAR (YA1)
30Tue 02 Aug 201107:30-08:00 AM*30mins*MARY COOK(PR271)*YASMIN AKHTAR (YA1)
31Tue 02 Aug 201108:15-09:15 AM*1 hour*AVTAR SINGH(WD401)*YASMIN AKHTAR (YA1)
32Tue 02 Aug 201109:15-10:15 AM*1 hour*HILDA *YOUNG(WD405)*YASMIN AKHTAR (YA1)
33Tue 02 Aug 201111:15-11:30 Lunchtime*15mins*VIOLET BLOFELD(WH287091)*YASMIN AKHTAR (YA1)
34Tue 02 Aug 201111:30-11:45 Lunchtime*15mins*ELIZABETH POWELL(WD203)*YASMIN AKHTAR (YA1)
35Tue 02 Aug 201112:00-12:30 Lunchtime*30mins*PERCY COLEMAN(WD410)*YASMIN AKHTAR (YA1)
36Tue 02 Aug 201112:30-13:00 Lunchtime*30mins*LILLIAN WOODLEY(WD301)*YASMIN AKHTAR (YA1)
37Tue 02 Aug 201113:15-13:45 Lunchtime*30mins*CHARLES BARRINGTON BATEMAN(WH2... * * * * * * * * * **YASMIN AKHTAR (YA1)
38Tue 02 Aug 201113:45-14:15 Lunchtime*30mins*BETTY MASKELL(WH229)*YASMIN AKHTAR (YA1)
39Tue 02 Aug 201114:15-14:30 Lunchtime*15mins*VIOLET *LACEY(WH177)*YASMIN AKHTAR (YA1)
Sheet 1




Many thanks in advance,

Allan
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Select column A and choose Edit|Go To|Special, check Blanks and click OK. Go to the Formula Bar, type =, point to the cell above the active cell and press Ctrl+Enter. You can copy/paste special values afterwards if you want.
 
Upvote 0
Hi Andrew,

Firstly, many thanks for your quick response!

I am getting some very odd results! When I followed your instructions, I was getting a fill series rather than copy (in column A). When I repeated the process for column H - every blank cell in column H was being populated with an equals sign!

Would you like me to post the results?

Will I be able to record a macro using this procedure?

Best Regards,

Allan
 
Upvote 0
I see you have a blank cell in A1. So rather than selecting the entire column select from A2 to the last used call in column A. Then follow the steps I outlined. A3 should be the active cell and its formula should be =A2. The formula in A4 should be =A3 and so on.
 
Upvote 0
Hi Andrew,

I am able to cut and paste A2 to A1, and then applied your process, it works brilliantly, and I was able to record a subroutine. Many thanks, your help is really appreciated.
 
Upvote 0

Forum statistics

Threads
1,224,593
Messages
6,179,791
Members
452,942
Latest member
VijayNewtoExcel

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