CHUNKYMONKEY
10-21-2008, 08:17 PM
I am often stuck performing this one task that I feel can be turned into a macro. I am not good with programming/creating macros, but was able to put this together with the very limited programming knowledge I do have.
Basically I have huge chunks of data that need to be chopped up and put on 6 different spreadsheets. I need to search by entity, and have a range of what the entitiy can fall on. all the entities that fall under the range need to go on one sheet, and so on. If the macro encounters an entitity that doesnt match the range mentioned below, i need to skip that data block. I need to copy the entire block of data that has the entities i mention below. I have sample code that i put together to give you an idea what I am looking for.
I have enclosed a sample of the data that needs the macro to help you visualize my situation.
Sub CopyData()
IF a row in column H Says Entity, and that same row in column I has a VALUE and column F has a cell that says Outstanding Credits,
THEN FOR VALUE,
IF Value = 1000,
THEN copy range of rows (between Entity and Outstanding Credits inclusive) to worksheet labeled ONE
ELSE IF Value = between & including 28001-28036,
THEN copy range of rows (between Entity and Outstanding Credits inclusive) to worksheet labeled TWO
ELSE IF Value = between & including 11001-16006,
THEN copy range of rows (between Entity and Outstanding Credits inclusive) to worksheet labeled THREE
ELSE IF Value = between & including 26810 - 26828,
THEN copy range of rows (between Entity and Outstanding Credits inclusive) to worksheet labeled FOUR
ELSE IF Value = between & including 98500-98759,
THEN copy range of rows (between Entity and Outstanding Credits inclusive) to worksheet labeled FIVE
ELSE IF Value = between & including 28050-28080,
THEN copy range of rows (between Entity and Outstanding Credits inclusive) to worksheet labeled SIX
I want to continue this loop for the remainder of the data , and in between these chunks of data that will be copied to each sheet, I need a blank space to separate each of them so I can see the different chunks clearly
END IF.
END IF
END SUB
Basically I have huge chunks of data that need to be chopped up and put on 6 different spreadsheets. I need to search by entity, and have a range of what the entitiy can fall on. all the entities that fall under the range need to go on one sheet, and so on. If the macro encounters an entitity that doesnt match the range mentioned below, i need to skip that data block. I need to copy the entire block of data that has the entities i mention below. I have sample code that i put together to give you an idea what I am looking for.
I have enclosed a sample of the data that needs the macro to help you visualize my situation.
Sub CopyData()
IF a row in column H Says Entity, and that same row in column I has a VALUE and column F has a cell that says Outstanding Credits,
THEN FOR VALUE,
IF Value = 1000,
THEN copy range of rows (between Entity and Outstanding Credits inclusive) to worksheet labeled ONE
ELSE IF Value = between & including 28001-28036,
THEN copy range of rows (between Entity and Outstanding Credits inclusive) to worksheet labeled TWO
ELSE IF Value = between & including 11001-16006,
THEN copy range of rows (between Entity and Outstanding Credits inclusive) to worksheet labeled THREE
ELSE IF Value = between & including 26810 - 26828,
THEN copy range of rows (between Entity and Outstanding Credits inclusive) to worksheet labeled FOUR
ELSE IF Value = between & including 98500-98759,
THEN copy range of rows (between Entity and Outstanding Credits inclusive) to worksheet labeled FIVE
ELSE IF Value = between & including 28050-28080,
THEN copy range of rows (between Entity and Outstanding Credits inclusive) to worksheet labeled SIX
I want to continue this loop for the remainder of the data , and in between these chunks of data that will be copied to each sheet, I need a blank space to separate each of them so I can see the different chunks clearly
END IF.
END IF
END SUB