Hi
I have this macro, kindly donated by excelxx, it was working good when i tested it on a couple of hundred rowns of data. I have now dropped the live data into the workbook list.xls and it just seems to be stopping now.
The live list.xls is about 30.000 rows. It looks in colums A & B, i am not sure if this is the cause but i have some 0s and blanks in them columns. It maybe there is just to much data.
Could someone please have a look and maybe suggest where its going wrong. I have highlighted (CODE STOPS HERE) where the code seems to stop
Thanks
Sub GetInfo()
Dim wbSum As Workbook: Dim wsSum As Worksheet
Dim wbList As Workbook: Dim wsList As Worksheet
Dim wbSupp As Workbook: Dim wsSupp As Worksheet
Dim wsMaster As Worksheet
ThisWorkbook.Worksheets(1).Range("A2").Activate
Application.ScreenUpdating = False
Workbooks.Open "C:\Documents and Settings\New Project\INFO\Summary.xls"
Set wbSum = ActiveWorkbook
Set wsSum = ActiveSheet
ActiveWindow.Visible = False
Workbooks.Open "C:\Documents and Settings\New Project\INFO\List.xls"
Set wbList = ActiveWorkbook
Set wsList = ActiveSheet
ActiveWindow.Visible = False
Workbooks.Open "C:\Documents and Settings\New Project\INFO\Supplier.xls"
Set wbSupp = ActiveWorkbook
Set wsSupp = ActiveSheet
ActiveWindow.Visible = False
Set wsMaster = ThisWorkbook.Worksheets(1)
t = 1: s = 1: v = wsMaster.UsedRange.Rows.Count + 1
Do Until t > wsSum.UsedRange.Rows.Count
S_NSL = wsSum.Cells(t, 15).Value
S_EAN = wsSum.Cells(t, 16).Value
Do Until s > wsList.UsedRange.Rows.Count
L_NSL = wsList.Cells(s, 1).Value (CODE STOPS HERE)
L_EAN = wsList.Cells(s, 2).Value
If S_NSL = L_NSL And S_EAN = L_EAN Then
wsMaster.Cells(v, 1).Value = wsList.Cells(s, 3).Value
wsMaster.Cells(v, 2).Value = S_NSL
wsMaster.Cells(v, 3).Value = wsSum.Cells(t, 17).Value
wsMaster.Cells(v, 4).Value = wsList.Cells(s, 4).Value
wsMaster.Cells(v, 5).Value = wsList.Cells(s, 5).Value
wsMaster.Cells(v, 6).Value = wsSum.Cells(t, 18).Value
wsMaster.Cells(v, 7).Value = wsList.Cells(s, 6).Value
Do Until w > wsSupp.UsedRange.Rows.Count
If wsMaster.Cells(v, 7).Value = wsSupp.Cells(w, 1).Value Then
wsMaster.Cells(v, 8).Value = wsSupp.Cells(w, 2).Value
w = wsSupp.UsedRange.Rows.Count
End If
w = w + 1
Loop
s = wsList.UsedRange.Rows.Count
v = v + 1
Else
End If
s = s + 1
Loop
s = 1: w = 1
t = t + 1
Loop
z = 3
wsMaster.Activate
Do Until z > ActiveSheet.UsedRange.Rows.Count
For n = 1 To 8
Cells(z, n).Borders.LineStyle = xlContinuous
Cells(z, n).NumberFormat = "General"
Cells(z, n).HorizontalAlignment = xlCenter
Cells(z, n).VerticalAlignment = xlCenter
Next n
Cells(z, 4).NumberFormat = "£#,##0.00"
Cells(z, 5).NumberFormat = "£#,##0.00"
Cells(z, 3).HorizontalAlignment = xlLeft
Cells(z, 6).HorizontalAlignment = xlLeft
Cells(z, 8).HorizontalAlignment = xlLeft
z = z + 1
Loop
wbSum.Close False
wbList.Close False
wbSupp.Close False
Application.ScreenUpdating = True
End Sub
Bookmarks