I am tryng to merge two macros here:
I have two macros
Each macro imports data from a text file, formats them appropriately (extracting data based on criteria) and placing them in designated columns in Sheet1
The macro do absolutely the same thing, except the format of each (placement of data in each cell) in the text file is a little different.
one macro (AggregateMetrics: ExtractDataX_Click) works with data prior to 3/2/05
the other (SummaryMetrics: ExtractDataY_Click) works with data prior after 3/2/05.
Reads text file and extracts specific data based on criteria.
They both work perfectly.
Except i am trying to merge the macro (instead of two) with IF statements to work based on criteria with just one text file that contains all the data.
If date is >= 3/2/05...extract this from cells and place here
else
extract this from cells and place here
Or perhaps If InStr(cell, "AGGREGATION METRICS:") > 0 Then ....
and If InStr(cell, "SUMMARY METRICS:") > 0 Then
Whichever is wiser!!
I have attachd what i have so far and it's doesn't pick up the correct data, even thouh they both work perfectly independently. But tryng to combine things here with an IF statement is such a nightmare, and i have spent so muchtime on this already and i am getting no where.
SO HERE IS WHAT I HAVE RESULTED TO: (correct me if this is a bad idea, I am open to suggestions please
)
I have a procedure where i call the two procedures [ExtractDataX_Click() and ExtractDataY_Click()] to extract data with each criteria, one after the other (see purple colored code).
However there is one problem with my offset(...)
I need the other procedure to pick up on the row where the other the other data left off. instead of overiding the data from the previous one.
I am having trouble with the offset, i have shown the line in red
Here's my code (excel also attached):
Thanks for taking the time to read my post.
Please feel free to give me suggestions, ideas, anything.
Bookmarks