LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default help needed with excel macro


I have a macro for consolidating sales data, but it's not doing exactl
what I need it to. I'm not a programmer, so doing this is a littl
beyond me.

I am using Excel XP.

The attached file (wtnov2.xls) is the data that we need to work with
the output I am looking for is a breakdown of how many of each Item
was sold. The point of sale software stores sales like this: say w
sold a 24 exp film (item#10024), prophetline would store it like this


10024 FUJ POP CN 135-4 1

If 5 were sold it would be stored like this:

10024 FUJ POP CN 135-4 5

So the macro would need to count how many cells contain matching item
's as well as adding the quantities if it is more that 1.

Currently, the macro only looks at the first and second columns, Item
and Desc. If I run the macro as is on wtnov.xls the quantites ar
totally out of whack.

Here's the code for the macro as it is now:


Sub ConsolidateData()

Dim i As Integer, ii As Integer, iii As Integer
Dim NumRows As Integer
NumRows = Range("A65536").End(xlUp).Row
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Columns("A:B").VerticalAlignment = xlVAlignTop
For i = 3 To NumRows + 3
For ii = i + 1 To NumRows + 3
If Trim(Cells(ii, 1)) = Trim(Cells(i, 1)) Then
iii = iii + 1
Else
If iii 0 Then
Range(Cells(i, 1), Cells(ii - 1, 1)).MergeCells = True
Range(Cells(i, 2), Cells(ii - 1, 2)).MergeCells = True
End If
Cells(i, 3) = iii + 1
i = ii - 1
iii = 0
Exit For
End If
Next ii
Next i
Application.ScreenUpdating = True
Application.DisplayAlerts = True

End Sub


Another thought I had was to not merge the cells but to:
1) Count the number of same Item numbers in column A and then add th
quantities if they are greater than 1
2) Then record the result to column D
3) Then delete the rows containing the duplicates

Clear as mud?

Thanks in advance for whatever help that you can give me...

Neil

+----------------------------------------------------------------
| Attachment filename: wtnov2.xls
|Download attachment: http://www.excelforum.com/attachment.php?postid=364549
+----------------------------------------------------------------

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel macro needed - find and move data The Kid Excel Discussion (Misc queries) 1 December 9th 09 04:14 AM
Excel Macro Needed [email protected] Excel Discussion (Misc queries) 2 April 2nd 08 10:36 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Save as Macro in excel - Help needed!! Cillian Excel Discussion (Misc queries) 1 January 10th 06 06:52 PM
Excel Find Macro Help Needed Bruce Johnson Excel Programming 2 September 27th 03 08:59 PM


All times are GMT +1. The time now is 03:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"