Hi all,
I have an excel list that pulls out data from a master list.
from column A onwards, it pulls out the item's name("A"), Date of Production("B") and total quantity("C").
For an item with different production dates, the total quantity are the same. So, I first sort out items according to their names, and merge the total quantities together to 1 cell. ( for example"A1" to "A5" are of the same item apple, and "A6" to "A11" are all bananas) So I need to merge the cells of total quantities from C1 to C5 and B6 to B11 respectively.
2 problems cropped out: 1) I used record macro, but it cannot dynamically merge the cells if the number of items change.
[vba]
Range("C1:C5").Select
Selection.Merge
Range("C6:C11").Select
Selection.Merge
[/vba]
2) When I run the macro, a msgbox keeps popping out:
"selection contains multiple data values. merging cells will keep the left uppermost data only."
so i tried using [vba]on error resume next[/vba] , but it still does not suppress the popup.
Please help!
I have an excel list that pulls out data from a master list.
from column A onwards, it pulls out the item's name("A"), Date of Production("B") and total quantity("C").
For an item with different production dates, the total quantity are the same. So, I first sort out items according to their names, and merge the total quantities together to 1 cell. ( for example"A1" to "A5" are of the same item apple, and "A6" to "A11" are all bananas) So I need to merge the cells of total quantities from C1 to C5 and B6 to B11 respectively.
2 problems cropped out: 1) I used record macro, but it cannot dynamically merge the cells if the number of items change.
[vba]
Range("C1:C5").Select
Selection.Merge
Range("C6:C11").Select
Selection.Merge
[/vba]
2) When I run the macro, a msgbox keeps popping out:
"selection contains multiple data values. merging cells will keep the left uppermost data only."
so i tried using [vba]on error resume next[/vba] , but it still does not suppress the popup.
Please help!