0% found this document useful (0 votes)
20 views

XML Table Fetch Backup

This code loops through rows of data in the 'Data' sheet, copies the values to the 'Output' sheet, and uses an advanced filter to copy related data from an 'XML' sheet. It copies the item value, a range of columns, and runs an advanced filter to populate additional columns.

Uploaded by

Noel Gregory
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

XML Table Fetch Backup

This code loops through rows of data in the 'Data' sheet, copies the values to the 'Output' sheet, and uses an advanced filter to copy related data from an 'XML' sheet. It copies the item value, a range of columns, and runs an advanced filter to populate additional columns.

Uploaded by

Noel Gregory
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Sub Button1_Click()

Dim i, j, k As Integer
Dim x(1, 0) As Variant
Dim y As Range
Dim rg, itemval, bleh, target As String
x(1, 0) = "<>"

Application.ScreenUpdating = False

Sheets("Output").Cells.Clear
ActiveWorkbook.Save

k = Application.WorksheetFunction.CountA(Sheets("Data").Range("A:A"))

For Each Item In Sheets("Data").Range("A1:A" & k)

Sheets("Output").Activate
Sheets("Output").Range("A1").Select
ActiveCell.SpecialCells(xlLastCell).Select
With Range("A" & ActiveCell.Row + 2)
.Value2 = Item.Value2
.Select
End With
bleh = ActiveCell.Offset(1, 0).Address
'column C, ABC variable

j = Application.WorksheetFunction.CountA(Sheets("Data").Range("C" & Item.Row &


":" & "ABC" & Item.Row))
target = bleh & ":" & Range(bleh).Offset(0, j - 1).Address
Sheets("data").Activate
Set y = Range(Cells(Item.Row, 3), Cells(Item.Row, j + 2))
'Column 3 variable
Sheets("Output").Range(target).Value = y.Value
x(0, 0) = Sheets("Data").Cells(Item.Row, Item.Offset(0, 2).Column).Value

Sheets("Output").Activate
Range("BS5:BS6") = x
Sheets("XML").Range("XML[#All]").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Range("BS5:BS6"), CopyToRange:=Range(target), Unique:=False

Next Item

Application.ScreenUpdating = True

End Sub

You might also like