Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm running into some difficulties breaking up an excel file into a
number of different excel files. Basically, I have a file with a large number of "sections"- the number of sections can vary from file to file, and the number of rows under each section can vary from file to file. I have it set up so that everytime there is a new chunk of data, the word "Layer" appears in column B. I was hoping that I could start from the bottom and work my way up, taking the last row, then finding the beginning of the section by location the last "Layer" in column B. Here's an example of what I'm talking about: A B C data Layer data data data data data Layer data data data data data data data data data data data Layer data data Layer data I had started to piece something together to identify the section, then I was going to select the range and move it to a new file. Here's what I have so far: Sub SectionSelection() Dim lastrow As Integer Dim firstrow As Integer lastrow = Range("B" & Rows.Count).End(xlUp).Row Application.ScreenUpdating = False Range("B65536").End(xlUp).Select While ActiveCell.Row 5 If ActiveCell.Value = "Layer" Then firstrow = ActiveCell.Row End If ActiveCell.Offset(-1, 0).Select Wend End Sub This doesn't work because even though it finds the "firstrow", it continues through the loop so that I can't do anything with my variable. Ideally what I would like to do is identify the last row, then the first row of the section, move it to a new file and save it, then continue through the next section of the file. Any ideas would be appreciated! Thanks, Marny |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sort rows and move borders with rows | New Users to Excel | |||
Move Rows to Columns | Excel Discussion (Misc queries) | |||
How do I move up rows below blank rows in an address? | Excel Worksheet Functions | |||
Move Rows & Append | Excel Programming | |||
how to move up and down different rows? | Excel Programming |