R
Rowan Drummond
Assuming the card number is in column A and the summary in Column B on
each sheet you might want to try something like:
Sub mvData()
Dim wks As Worksheet
Dim newSht As Worksheet
Dim eRow As Long
Dim c As Long
Dim r As Long
Dim sht As Long
Dim fndCell As Range
Dim card As String
Dim calcMode As Long
On Error GoTo Error_Handler
calcMode = Application.Calculation
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
r = 2
Set newSht = Sheets.Add
With newSht
.Move before:=Sheets(1)
.Range("A1").Value = "Card #"
End With
For Each wks In Worksheets
If wks.Name <> newSht.Name Then
With wks
newSht.Cells(1, .Index) = .Name
eRow = .Cells(Rows.Count, 1).End(xlUp).Row
For c = 2 To eRow
card = .Cells(c, 1).Value
Set fndCell = newSht.Columns(1).Find(what:=card _
, LookIn:=xlValues, lookat:=xlWhole)
If Not fndCell Is Nothing Then
fndCell.Offset(0, .Index - 1).Value = _
.Cells(c, 2).Value
Else
newSht.Cells(r, 1).Value = card
newSht.Cells(r, .Index).Value = _
.Cells(c, 2).Value
r = r + 1
End If
Set fndCell = Nothing
Next c
End With
End If
Next wks
Error_Handler:
Application.ScreenUpdating = True
Application.Calculation = calcMode
End Sub
Hope this helps
Rowan
each sheet you might want to try something like:
Sub mvData()
Dim wks As Worksheet
Dim newSht As Worksheet
Dim eRow As Long
Dim c As Long
Dim r As Long
Dim sht As Long
Dim fndCell As Range
Dim card As String
Dim calcMode As Long
On Error GoTo Error_Handler
calcMode = Application.Calculation
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
r = 2
Set newSht = Sheets.Add
With newSht
.Move before:=Sheets(1)
.Range("A1").Value = "Card #"
End With
For Each wks In Worksheets
If wks.Name <> newSht.Name Then
With wks
newSht.Cells(1, .Index) = .Name
eRow = .Cells(Rows.Count, 1).End(xlUp).Row
For c = 2 To eRow
card = .Cells(c, 1).Value
Set fndCell = newSht.Columns(1).Find(what:=card _
, LookIn:=xlValues, lookat:=xlWhole)
If Not fndCell Is Nothing Then
fndCell.Offset(0, .Index - 1).Value = _
.Cells(c, 2).Value
Else
newSht.Cells(r, 1).Value = card
newSht.Cells(r, .Index).Value = _
.Cells(c, 2).Value
r = r + 1
End If
Set fndCell = Nothing
Next c
End With
End If
Next wks
Error_Handler:
Application.ScreenUpdating = True
Application.Calculation = calcMode
End Sub
Hope this helps
Rowan