![]() |
Array is best?
Marie,
You need a table listing the branches, and giving the district for each in a column to the right. Then a VLOOKUP would give you the district. -- Earl Kiosterud mvpearl omitthisword at verizon period net ------------------------------------------- "Marie" wrote in message ... I have a huge amount of data that is downloaded daily. I have the data in a worksheet and need to extract a district from the data. The problem is the data only has a branch number, so I have to sort the information by branch number and manually match that branch number with the district then delete the rows that I do not need. I have 18 districts that I have to match to over 100 branches. There is also other criteria that macros pick up from the data based on the district number. If I just had a seperate macro I could run first and eliminate the branches I don't need it would save me so much time. The branches are not in numerical sequence either, for instance one district might have 55, 56, 122, 123, 124, 125 and 137 as their branches but I have to match it to another sheets data that only has the district number 122 and so on. I was trying to set up arrays that like the example below before all the other criteria. I can't get it to work. If Range(Array(,55,56,122,123,124,125, 137) 'district 122 cell.offset (0,1).value else Selection.EntireRow.Delete |
Array is best?
Thanks for your suggestion.
That would work if I didn't have all the other select criteria. I need a line before the other selections I make to just keep the rows with the correct branches and delete all the other rows. I hope I am making sense! I have several sheets. The information I download does not have the necessary district info so to compare it with all the criteria in my other macros I have manually been deleting the rows I don't need. I think there must be a way to add a line - or two- above my select criteria to say if it matches the district number on sheet one, and falls into the array of branch numbers in sheet two 'do nothing' if not delete the row - then I would be able to continue with my other If statements. I have written codes in the past to try to accomplish this but they have always deleted all the information - cleaned the whole page! Maybe I just need to continue to sort and delete manually. I have been reading a lot on this board and with everything that seems to be possible I was hoping there was a way....I have also been reading a vb for applications book but can't find the answer there either. "Earl Kiosterud" wrote: Marie, You need a table listing the branches, and giving the district for each in a column to the right. Then a VLOOKUP would give you the district. -- Earl Kiosterud mvpearl omitthisword at verizon period net ------------------------------------------- "Marie" wrote in message ... I have a huge amount of data that is downloaded daily. I have the data in a worksheet and need to extract a district from the data. The problem is the data only has a branch number, so I have to sort the information by branch number and manually match that branch number with the district then delete the rows that I do not need. I have 18 districts that I have to match to over 100 branches. There is also other criteria that macros pick up from the data based on the district number. If I just had a seperate macro I could run first and eliminate the branches I don't need it would save me so much time. The branches are not in numerical sequence either, for instance one district might have 55, 56, 122, 123, 124, 125 and 137 as their branches but I have to match it to another sheets data that only has the district number 122 and so on. I was trying to set up arrays that like the example below before all the other criteria. I can't get it to work. If Range(Array(,55,56,122,123,124,125, 137) 'district 122 cell.offset (0,1).value else Selection.EntireRow.Delete |
All times are GMT +1. The time now is 02:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com