Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default VBA Code help

Jay,

Try this - I wasn't sure what to do with columns 3 through 6, so I just summed them....

HTH,
Bernie
MS Excel MVP


Sub TryNow()
Dim myR As Range
Dim myC1 As Range
Dim myC2 As Range
Dim myV As String
Dim myRow As Long

myRow = Cells(Rows.Count, 1).End(xlUp)(4).Row

On Error GoTo Done
While True
myV = ""
Set myR = Range("A1").CurrentRegion
myR.AutoFilter Field:=2, Criteria1:=Range("B2").Value
Set myC1 = myR.Offset(1, 0).Resize(myR.Rows.Count - 1)

For Each myC2 In myC1.Columns(1).SpecialCells(xlCellTypeVisible)
If myV = "" Then
myV = myC2.Value
ElseIf myC2.Value < "" Then
myV = myV & ", " & myC2.Value
End If
Next myC2
Cells(myRow, 1).Value = myV
Cells(myRow, 2).Value = Range("B2").Value
With Range("C" & myRow).Resize(, 4)
.FormulaR1C1 = "=SUBTOTAL(9,R2C:R[-4]C)"
.Value = .Value
End With
myC1.EntireRow.Delete
myRow = Cells(Rows.Count, 1).End(xlUp)(2).Row
ActiveSheet.ShowAllData
Wend

Done:
Range("A:A").SpecialCells(xlCellTypeBlanks).Entire Row.Delete
Range("A1").CurrentRegion.AutoFilter
End Sub




***********************************************88 88


I do nto want to make a new sheet for each catalog number. I want to
copy all catalog types from the data base to another workbook and
concatenate the item numbers.

A = Item#
B= Catalog

Row 1 is A = 1234 and B = 2
Row 2 is A = 1235 and B = 3
Row 3 is A = 1236 and B = 2

I need the code to find each of the different catalog numbers and move
it to another workbook so the new workbook woudl look like this
Row 1 is A = 1234, 1236 and B = 2
Row 2 is A = 1235 and B = 3

I hope this paints a better picture of what I am trying to accomplish.

thanks,
Jay


 
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
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
Convert a Number Code to a Text Code Traye Excel Discussion (Misc queries) 3 April 6th 07 09:54 PM
Unprotect Code Module in Code Damien Excel Discussion (Misc queries) 2 April 18th 06 03:10 PM
Need 2 add second then third code with first code in the Tab View nick s Excel Worksheet Functions 3 December 6th 05 02:20 AM
copying vba code to a standard code module 1vagrowr Excel Discussion (Misc queries) 2 November 23rd 05 04:00 PM


All times are GMT +1. The time now is 02:19 AM.

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"