Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- iRow = PullRange.Find(What:=a(x, 0)).Row - 1
- Public Sub DataDump(Sql As String, PullColumn As String)
- Dim a() As Variant
- Dim iRow As Integer
- Dim PullRange As Range
- Dim DumpRange As Range
- Dim x As Integer
- Dim y As Integer
- Set PullRange = Range(PullColumn & ":" & PullColumn)
- Set DumpRange = Range("H1")
- Set recs = New ADODB.Recordset
- recs.Open Sql, con, adOpenDynamic
- a = recs.GetRows
- 'a(y, x)
- For x = 0 To UBound(a, 2)
- If IsNull(a(0, x)) Then GoTo none
- iRow = PullRange.Find(What:=a(0, x)).Row - 1
- If iRow = 0 Then GoTo none
- For y = 1 To UBound(a, 1)
- Debug.Print a(y, x)
- If IsNull(a(y, x)) Then GoTo Err
- DumpRange.Offset(iRow, y) = a(y, x)
- Err:
- Next y
- none:
- Next x
- End Sub
Add Comment
Please, Sign In to add comment