copy data from merged cell

nasir

Board Regular
Joined
Apr 7, 2006
Messages
124
I have the following sheet and need to break up the data in the cell into two columns and copy to another workbook. I also need the code to sum the data data into 0100 LOCAL FUND, 0600 SPECIAL PURPOSE REVENUE FUNDS, 0700 INTRADISTRICT FUNDS. These are the only data I want the code to copy to another workbook and insert totals, bold, line above and below.

This is how the data looks like:
Excel Workbook
ABCDE
7Comp Source GroupAppropriation
80011 * REGULAR PAY - CONT FULL TIME2,879,113
90012 * REGULAR PAY - OTHER411,762
100013 * ADDITIONAL GROSS PAY124,474
110014 * FRINGE BENEFITS - CURR PERSONNEL659,678
120015 * OVERTIME PAY300,000
130099 * UNKNOWN PAYROLL POSTINGS0
1401 * PERSONNEL SERVICES4,375,027
150020 * SUPPLIES AND MATERIALS155,000
160030 * ENERGY, COMM. AND BLDG RENTALS4,765,536
170031 * TELEPHONE, TELEGRAPH, TELEGRAM, ETC97,355
180032 * RENTALS - LAND AND STRUCTURES9,350,784
190033 * JANITORIAL SERVICES203,618
200034 * SECURITY SERVICES1,590,686
210035 * OCCUPANCY FIXED COSTS1,179,726
220040 * OTHER SERVICES AND CHARGES1,564,449
230041 * CONTRACTUAL SERVICES - OTHER3,085,758
240070 * EQUIPMENT & EQUIPMENT RENTAL262,604
2502 * NON-PERSONNEL SERVICES22,255,516
260100 * LOCAL FUND26,630,543
270011 * REGULAR PAY - CONT FULL TIME0
280014 * FRINGE BENEFITS - CURR PERSONNEL0
2901 * PERSONNEL SERVICES0
300020 * SUPPLIES AND MATERIALS0
310040 * OTHER SERVICES AND CHARGES0
320041 * CONTRACTUAL SERVICES - OTHER0
330070 * EQUIPMENT & EQUIPMENT RENTAL0
3402 * NON-PERSONNEL SERVICES0
350150 * FEDERAL PAYMENTS0
360041 * CONTRACTUAL SERVICES - OTHER2,000,000
3702 * NON-PERSONNEL SERVICES2,000,000
380200 * FEDERAL GRANT FUND2,000,000
390040 * OTHER SERVICES AND CHARGES0
400041 * CONTRACTUAL SERVICES - OTHER21,000,000
4102 * NON-PERSONNEL SERVICES21,000,000
420355 * CAPITAL FUND - FEDERAL PAYMENT21,000,000
430011 * REGULAR PAY - CONT FULL TIME743,557
440012 * REGULAR PAY - OTHER135,000
450013 * ADDITIONAL GROSS PAY0
460014 * FRINGE BENEFITS - CURR PERSONNEL158,755
470015 * OVERTIME PAY0
480099 * UNKNOWN PAYROLL POSTINGS0
4901 * PERSONNEL SERVICES1,037,313
500020 * SUPPLIES AND MATERIALS15,000
510030 * ENERGY, COMM. AND BLDG RENTALS0
520031 * TELEPHONE, TELEGRAPH, TELEGRAM, ETC0
530032 * RENTALS - LAND AND STRUCTURES10,614
540040 * OTHER SERVICES AND CHARGES1,359,010
550041 * CONTRACTUAL SERVICES - OTHER5,899,110
560070 * EQUIPMENT & EQUIPMENT RENTAL0
5702 * NON-PERSONNEL SERVICES7,283,734
580600 * SPECIAL PURPOSE REVENUE FUNDS8,321,047
590011 * REGULAR PAY - CONT FULL TIME10,068,040
600012 * REGULAR PAY - OTHER1,001,491
610013 * ADDITIONAL GROSS PAY655,000
620014 * FRINGE BENEFITS - CURR PERSONNEL2,356,162
630015 * OVERTIME PAY1,876,508
640099 * UNKNOWN PAYROLL POSTINGS0
6501 * PERSONNEL SERVICES15,957,201
660020 * SUPPLIES AND MATERIALS142,883
670030 * ENERGY, COMM. AND BLDG RENTALS640,054
680031 * TELEPHONE, TELEGRAPH, TELEGRAM, ETC307,414
690032 * RENTALS - LAND AND STRUCTURES0
700033 * JANITORIAL SERVICES283,149
710034 * SECURITY SERVICES0
720035 * OCCUPANCY FIXED COSTS0
730040 * OTHER SERVICES AND CHARGES3,419,750
740041 * CONTRACTUAL SERVICES - OTHER40,168,951
750070 * EQUIPMENT & EQUIPMENT RENTAL1,429,756
7602 * NON-PERSONNEL SERVICES46,391,956
770700 * INTRADISTRICT FUNDS62,349,157
Page1_1


And this is how I want the other workbook where we copied the data to look like:


Excel Workbook
BCDE
12REGULAR PAY - CONT FULL TIME*0011* * * * * * * * * * * 2,879,113
13REGULAR PAY - OTHER*0012* * * * * * * * * * * * *411,762
14ADDITIONAL GROSS PAY*0013* * * * * * * * * * * * 124,474
15RINGE BENEFITS - CURR PERSONNEL*0014* * * * * * * * * * * *659,678
16OVERTIME PAY*0015* * * * * * * * * * * *300,000
17UNKNOWN PAYROLL POSTINGS*0099* * * * * * * * * * * * * * * * * * * -
18PERSONNEL SERVICES*** * * * *4,375,027
Table 1-YTD Exp and Fore


Thank you
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Try
Rich (BB code):
Sub test()
    Dim cell As Range, ra As Range: Application.ScreenUpdating = False
    Set ra = Range([A8], Range("A" & Rows.Count).End(xlUp))
    For Each cell In ra.Cells
        Arr = Split(cell, " * "): cell.UnMerge
        cell.Resize(, 4) = Array(Arr(1), "*", "", "'" & Arr(0))
    Next cell
    Application.ScreenUpdating = True
End Sub

Example:

 
Upvote 0
Thanks but I am getting an "Subscript out of range" error. It unmerge the rows but it did not copy the sentences in the cell to different cells.
 
Upvote 0
I think the error is in

cell.Resize(, 4) = Array(Arr(), "*", "", "'" & Arr(0))

because it is highlighted.
 
Upvote 0
I see where the problem is with the code. For some reason when I copied my data to this website it added * which is something I do not have in my original file
My data looks like this
0011 REGULAR PAY - CONT FULL TIME
0012 REGULAR PAY - OTHER
0013 ADDITIONAL GROSS PAY
0014 FRINGE BENEFITS - CURR PERSONNEL
0015 OVERTIME PAY
0099 UNKNOWN PAYROLL POSTINGS

There is no * between 0011 and Regular....

They are all in once cell and merged columne A - D. I need to copy the 0011 to column C of a different file called FRP and the REGULAR PAY - CONT FULL TIME to column B of FRP file.

How can I accomplish this.

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,264
Messages
6,171,081
Members
452,377
Latest member
bradfordsam

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