Guest User

Untitled

a guest
Oct 24th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. iRow = PullRange.Find(What:=a(x, 0)).Row - 1
  2.  
  3. Public Sub DataDump(Sql As String, PullColumn As String)
  4. Dim a() As Variant
  5. Dim iRow As Integer
  6. Dim PullRange As Range
  7. Dim DumpRange As Range
  8. Dim x As Integer
  9. Dim y As Integer
  10.  
  11. Set PullRange = Range(PullColumn & ":" & PullColumn)
  12. Set DumpRange = Range("H1")
  13.  
  14.  
  15. Set recs = New ADODB.Recordset
  16.  
  17. recs.Open Sql, con, adOpenDynamic
  18.  
  19.  
  20. a = recs.GetRows
  21.  
  22. 'a(y, x)
  23.  
  24.  
  25. For x = 0 To UBound(a, 2)
  26. If IsNull(a(0, x)) Then GoTo none
  27. iRow = PullRange.Find(What:=a(0, x)).Row - 1
  28. If iRow = 0 Then GoTo none
  29. For y = 1 To UBound(a, 1)
  30. Debug.Print a(y, x)
  31. If IsNull(a(y, x)) Then GoTo Err
  32. DumpRange.Offset(iRow, y) = a(y, x)
  33. Err:
  34. Next y
  35. none:
  36. Next x
  37.  
  38.  
  39.  
  40. End Sub
Add Comment
Please, Sign In to add comment