Hello,
I get a data file once a week, and I've built a macro to clean it as needed. Unfortunately, my original macro relied on the columns of the data provided to be in the same order each week, an assumption that has proved false.
The code below is supposed to scan through the fields of row 1, find the one containing "source", and record that column in a variable called SourceColumn.
Sub CANVASS_MANIPULATION()
Dim SourceColumn As Integer
Dim Column As Integer
SourceColumn = 65
Column = 65
Do While SourceColumn = 65
Range("O1").Value = Range(Chr(Column) & "1").Value
Range("O3").Value = Column
If Range(Chr(Column) & "1").Value = "SOURCE" Then
SourceColumnn = Column
Range("O2").Value = "SUCCESS"
Range("O4").Value = SourceColumn
End If
Column = Column + 1
Loop
end sub()
Every part of the above seems to work except [SourceColumn = Column]. For some reason, SourceColumn remains 65. I've attached the row that the above code is supposed to read. I appreciate any help anyone can give me, and I apologize in advance if I don't respond to your help quickly. I'm about to hop on a plane.
Thanks so much!
Will
Bookmarks