Skip to content

Instantly share code, notes, and snippets.

@danhendrix
Created September 5, 2013 21:02
Show Gist options
  • Save danhendrix/6456123 to your computer and use it in GitHub Desktop.
Save danhendrix/6456123 to your computer and use it in GitHub Desktop.
pricing import
Sub importPrices()
'
' importPrices Macro
'
Range("p9").Select
Dim counter As Integer
Dim pointerCount As Integer
Dim pointer As Range
Dim myRange As Range
counter = 1
Set myRange = Sheets("Pricing").Range("a9:A43")
While counter < 30
If ActiveCell.Value = "False" Then
pointerCount = 1
Set pointer = ActiveSheet.Cells(ActiveCell.Row, 1).Offset(0, 1)
While pointerCount < 5
Sheets("Import").Range("A" & Rows.Count).End(xlUp).Offset(1).Value = pointer.Offset(0, 0)
Sheets("Import").Range("B" & Rows.Count).End(xlUp).Offset(1).Value = pointer.Offset(0, 1)
Sheets("Import").Range("C" & Rows.Count).End(xlUp).Offset(1).Value = pointerCount
Sheets("Import").Range("D" & Rows.Count).End(xlUp).Offset(1).Value = pointer.Offset(0, 2)
Sheets("Import").Range("E" & Rows.Count).End(xlUp).Offset(1).Value = pointer.Offset(0, 3)
Sheets("Import").Range("F" & Rows.Count).End(xlUp).Offset(1).Value = pointer.Offset(0, 4)
Sheets("Import").Range("G" & Rows.Count).End(xlUp).Offset(1).Value = pointer.Offset(0, 5)
Sheets("Import").Range("H" & Rows.Count).End(xlUp).Offset(1).Value = Application.WorksheetFunction.VLookup(pointer.Offset(0, -1), myRange, 2, False)
pointerCount = pointerCount + 1
Wend
Else
End If
counter = counter + 1
ActiveCell.Offset(1, 0).Select
Wend
'
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment