
Originally Posted by
internet_imran
......code work well but this is not possible for me to understand the code.......I changes on ledger sheet for better understanding to final touch on the code. .....
Hi Imran,
. I will assume you wish me to modify my code for your Format requirements. I was wanting some confirmation of that, but you may have not understood too well.
.
. So:
. My approach is fairly straight forward: "......I needed a macro modification that is so simple it could be written with the macro recorder....”
.
. The important code line are all unknown to me so I simply ran a macro recording whilst making Format changes of the sort you have asked for.
.
. The trick is then to know where to put that Formatting in. After section 3b) the relevant cell co-ordinate info is there, but I will start this section as at point 3e) as my Output Array has been transposed to the correct final orientation and is somewhat easier now to visualise. Horizontal co-ordinates are in the same relative position but are offset by the Long variable TablesOffset
Criteria Given by Imran:
Please made some change:
Bold and Underline style
1) Heading cells bold + Balance cells bold
2) 2nd row bold like Month name , debit and credit cells
3) Top border on July , Debit and Credit cells
4) Top border on Bal Cells data
5) on Debit Cells Column come Right Border
Merge cells data
1) Heading cells Merge
2) Debit Cells Merge
3) Credit Cells Merge like as above
. The Following code was obtained after:
. 1 ) “Tidying up” that code given by macro recorder
.............................................
. 2 ) Some of the cell “row” co-ordinates are replaced by appropriate Array parameters that could vary from table to table
... the above code then needs to be incorporated into section 3e).
. A nice convenient way to do this was to treat all the above lines as Range Properties and arrange for them to be applied to the Range Object which is the Top left cell of each Table. This cell is already used in the code as the reference start point for each Table. This makes good use of the Code section obtained from the Macro by Virtue of the fact that Cell and Range properties relate to the relative positions “going out” from the point of that Range Object
http://excelmatters.com/referring-to-ranges-in-vba/
http://www.mrexcel.com/forum/excel-q...ml#post4034765
. Section 3e) then becomes
Full modified code here:
http://www.excelforum.com/developmen...ml#post4188405
And here
http://www.excelforum.com/developmen...ml#post4188406
NOTE: The code was too big to fit in one post. BUT IT IS ALL ONE PROGRAM. Copy the second part immediately under the first part in the same module.
This is a small part of the new Output achieved
Using Excel 2007
Row\Col |
A |
B |
C |
D |
E |
F |
1 |
Rent Expense |
|
|
|
|
|
2 |
July |
Debit |
|
|
Credit |
|
3 |
|
2 |
100 |
|
|
|
4 |
|
|
100 |
|
|
0 |
5 |
Bal |
|
100 |
|
|
|
6 |
|
|
|
|
|
|
( My screenshot does not show the new formating, but it IS there as you wanted)
. Please let me know how you get on.
Alan
Bookmarks