Hi there,
i have a problem to sort merged cells in the file attached. i tried via macro but could not reached a good solution. I have 30 plans inside the sheet and even manually is too hard to do it because i use some "=" to not type again every number since some are the same but when i try to sort the lines became diferent values.
more explanation inside the file.
Tks for your attention.
Why did yuo merge cells? You could rich the same result by enlarging column width.Can't you now unmerge them?
I suggest you to unmerge em all, then delete unnecesary columns. and set width, say 25 pt.?!![]()
Люди, питающие благие намерения, как раз и становятся чудовищами.
Regards, «Born in USSR»
Vusal M Dadashev
Baku, Azerbaijan
well you can start by unmerging cells then alignment horizontal center across selection instead to give the same appearence
Mojito connoisseur and a dabbler in Cisco
where does code go ?
look here
how to insert code
how to enter array formula
why use -- in sumproduct
recommended reading
wiki Mojito
how to say no convincingly
most important thing you need
Martin Wilson: SPV
and RSMBC
Try this and see if
notice!......the big guys out there..
P.S.Code:Sub TidyPasta() Cells.MergeCells = False r = Cells(1, 1).End(xlDown).Row c = Cells(r, Columns.Count).End(xlToLeft).Column + 6 For i = c To 3 Step -1 If Cells(Rows.Count, i).End(xlUp).Row = 1 Then Columns(i).Delete End If Next r = Cells(Rows.Count, 1).End(xlUp).Row For i = r To 2 Step -1 Range("F" & i & ":G" & i).MergeCells = True Range("A" & i & ":B" & i).MergeCells = True Next Columns("A:G").ColumnWidth = 12.75 End Sub
Before running
Delete the instructions and result you need to obtain shown in your sample workbook.
Cheers
Last edited by Marcol; 02-22-2010 at 09:43 AM. Reason: P.S. added
well, i got some different result in my test here.. please see bellow the result from the code and the result expected.
result from code resullt expected
10 00235 01 ==== 10 00231 01
10 00235 05 ==== 10 00231 08
10 00235 06 ==== 10 00231 10
10 00380 07 ==== 10 00231 11
10 00380 08 ==== 10 00231 12
10 00380 09 ==== 10 00231 18
10 00231 10 ==== 10 00235 01
10 00231 11 ==== 10 00235 05
10 00231 12 ==== 10 00235 06
10 00231 18 ==== 10 00380 07
10 00231 08 ==== 10 00380 08
10 00231 01 ==== 10 00380 09
the Columns A and B (as second condition) were not well sorted..
Last edited by stazevedo; 02-22-2010 at 01:08 PM. Reason: a better explanation
Okay
Can't do it tonight
If no one else offers a solution
Look back early tomorrow
Cheers
Avoid Merged Cells like the plague
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
Check out the free Excel Toolbar
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Code Tags: Make your code easier for us to read
Agreed Roy !!!!
-----but that's what
......want?......the big guys out there..
The source is probably not native Excel but comes from a reporting system like Chrystal Reports or Business Objects. Notorious for putting gazillions of columns in between fields and merging across. Looking at the number of columns involved in the display of five values, I bet that's what it is.
teylyn
Microsoft MVP - Excel
At Excelforum, you can say "Thank you!" by clicking theicon below the post.
Avoid pie charts with more than two data points. Why? See here (pdf, 559 kb). The only acceptable pie chart is here.
Hi seems nobody else took up the gauntlet
There are a few hidden traps in this problem.
1/. Umpteen merged columns - unmerged and redundant cols removed to allow sorting
2/. Formulae in all tables - removed there seems no good reason for them (when sorted the result is garbage if the formulae is retained.
3/. Total 12 in example seems to be a count - no formula other totals - formula retained
4/. All Tables must have 14 rows including Header & Totals rows and must be separated by at least 1 blank row
5/. I can see no good reason for merging A&B and F&G but that is your request.'comment out or delete as per note in code if you change your mind.
**********ALL ADVICE IS TO AVOID MERGED CELLS*************
Have a look at Sheet "1" and then run the code there.
Best of luck with ......the big guys out there..
Alistair
P.S.
teylyn
Crystal reports a blast from the past - haven't seen them in years!
I copied the chart I was trying to sort and pasted it onto the next sheet with "paste as values." Sorted fine after that.
jwnyc
@jwnyc,
I don't see any connection of your comment to the question. Please take heed when posting comments. Have a look at the forum rules before posting anything else.
teylyn
Microsoft MVP - Excel
At Excelforum, you can say "Thank you!" by clicking theicon below the post.
Avoid pie charts with more than two data points. Why? See here (pdf, 559 kb). The only acceptable pie chart is here.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks