You are on page 1of 2

Sub extraerdatos()

Sheets("mapping").Select

Range("A2").Select

Range(Selection, Selection.End(xlToRight)).Select

Range(Selection, Selection.End(xlDown)).Select

Selection.ClearContents

Range("A2").Select

Dim ultfildatos As Long

Dim ultfilpedidos As Long

Dim identificador As String

Dim bodegaorigen As String

Dim bodegadestino As String

Dim referencia As String

Dim unidades As Long

Dim lote As String

Dim observaciones As String

Dim cont As Long

ultfildatos = Sheets("BDmapping").Range("A" & Rows.Count).End(xlUp).Row

For cont = 2 To ultfildatos

identificador = Sheets("BDmapping").Cells(cont, 1)

bodegaorigen = Sheets("BDmapping").Cells(cont, 2)

bodegadestino = Sheets("BDmapping").Cells(cont, 3)

referencia = Sheets("BDmapping").Cells(cont, 4)

unidades = Sheets("BDmapping").Cells(cont, 5)

lote = Sheets("BDmapping").Cells(cont, 6)
observaciones = Sheets("BDmapping").Cells(cont, 7)

If unidades > 0 Then

ultfilpedidos = Sheets("mapping").Range("A" & Rows.Count).End(xlUp).Row

Sheets("mapping").Cells(ultfilpedidos + 1, 1) = identificador

Sheets("mapping").Cells(ultfilpedidos + 1, 2) = bodegaorigen

Sheets("mapping").Cells(ultfilpedidos + 1, 3) = bodegadestino

Sheets("mapping").Cells(ultfilpedidos + 1, 4) = referencia

Sheets("mapping").Cells(ultfilpedidos + 1, 5) = unidades

Sheets("mapping").Cells(ultfilpedidos + 1, 6) = lote

Sheets("mapping").Cells(ultfilpedidos + 1, 7) = observaciones

End If

Next cont

End Sub

You might also like