title: how can i reduce the process time with excel vba
body: <p>I am using excel vba 2010 to create two spreadsheets in a workbook that already exists.
  The source for these new spreadsheets is another workbook with 12 spreadsheets (each one with 40000 rows) the first time that I am creating these two spreadsheets took more than 2 hours. (I have chosen aprox. 13000 rows to create these two spreadsheets). How can I reduce the time consumption?</p>
  
  <pre><code>Sub creaInventarios(wkArchivoROT, wkArchivoDatos)
  
  Dim book_I As Workbook, wbk1 As Workbook
  Dim sheet_IQB As Worksheet, sheet_I As Worksheet, sheet_P As Worksheet, sheet_FIN As Worksheet
  Dim longitudCampo As Integer
  Dim nf As Long, nfo As Long, orden As Long, divida As Long, queda As Long, nf1 As Long, canrow As Long
  Dim chkInventario As String
  
  Dim texto As Range
  Dim codigoItem As Range
  Dim descrItem As Range
  Dim itemVendedor As Range
  Dim puntoReorden As Range
  Dim qtyOnHand As Range
  Dim qtyOnSale As Range
  Dim qtyAvailable As Range
  Dim suggestReorden As Range
  Dim qtyReorden As Range
  Dim earlySale As Range
  Dim salesThisWeek As Range
  
  Dim errorCampo As Boolean
  
  Set book_I = Workbooks.Open(wkArchivoROT)
  
  Set sheet_I = book_I.Worksheets(9)
  Set sheet_P = book_I.Worksheets(8)
  
  Set wbk1 = Workbooks.Open(wkArchivoDatos)
  Set sheet_FIN = wbk1.Worksheets("Final")
  nf = 3
  nfo = 7
  orden = 0
  
  lee_Fin:
  
  If sheet_FIN.Range("C" &amp; nf) = " " Or sheet_FIN.Range("C" &amp; nf) = vbNullString Then
      If sheet_FIN.Range("B" &amp; nf).Value = " " Or sheet_FIN.Range("B" &amp; nf) = vbNullString Then
          GoTo finInventario
      End If
  End If
  queda = Len(sheet_FIN.Range("C" &amp; nf).Value)
  If queda = 0 Then
      nf = nf + 1
      GoTo lee_Fin
  End If
  Set codigoItem = sheet_FIN.Range("C" &amp; nf)
  chkInventario = Mid(codigoItem.Value, 1, 3)
  If chkInventario = "MPA" Or chkInventario = "MPC" Or chkInventario = "PPA" Or chkInventario = "PTC" Then
      GoTo checkIgual
  Else
      nf = nf + 1
      GoTo lee_Fin
  End If
  
  checkIgual:
  
  Set texto = sheet_FIN.Range("B" &amp; nf)
  
  Set descrItem = sheet_FIN.Range("D" &amp; nf)
  Set itemVendedor = sheet_FIN.Range("E" &amp; nf)
  Set puntoReorden = sheet_FIN.Range("F" &amp; nf)
  Set qtyOnHand = sheet_FIN.Range("G" &amp; nf)
  Set qtyOnSale = sheet_FIN.Range("H" &amp; nf)
  Set qtyEnsamble = sheet_FIN.Range("I" &amp; nf)
  Set qtyAvailable = sheet_FIN.Range("J" &amp; nf)
  Set suggestReorden = sheet_FIN.Range("L" &amp; nf)
  Set qtyReorden = sheet_FIN.Range("M" &amp; nf)
  Set earlySale = sheet_FIN.Range("N" &amp; nf)
  Set salesThisWeek = sheet_FIN.Range("O" &amp; nf)
  
  sheet_P.Range("A" &amp; nfo).Value = codigoItem.Value
  sheet_I.Range("A" &amp; nfo).Value = codigoItem.Value
  
  sheet_P.Range("B" &amp; nfo).Value = descrItem.Value
  sheet_I.Range("B" &amp; nfo).Value = descrItem.Value
  
  sheet_P.Range("C" &amp; nfo).Value = puntoReorden.Value
  
  sheet_I.Range("C" &amp; nfo).Value = qtyOnHand.Value
  sheet_P.Range("D" &amp; nfo).Value = qtyOnHand.Value
  
  'sheet_I.Range("C" &amp; nfo).Value = qtyAvailable.Value
  'sheet_P.Range("D" &amp; nfo).Value = qtyAvailable.Value
  
  sheet_I.Range("D" &amp; nfo).Value = qtyOnSale.Value
  sheet_P.Range("E" &amp; nfo).Value = qtyOnSale.Value
  
  sheet_I.Range("E" &amp; nfo).Value = qtyEnsamble.Value * -1
  sheet_P.Range("F" &amp; nfo).Value = qtyEnsamble.Value * -1
  
  sheet_I.Range("F" &amp; nfo).Value = qtyAvailable.Value
  sheet_P.Range("G" &amp; nfo).Value = qtyAvailable.Value
  
  orden = orden + 1
  sheet_I.Range("U" &amp; nfo).Value = orden
  sheet_P.Range("L" &amp; nfo).Value = orden
  nfo = nfo + 1
  nf = nf + 1
  GoTo lee_Fin
  
  finInventario:
  MsgBox "Continuar", vbInformation, "WARNING"
  End Sub
  </code></pre>