LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Move rows to a new file

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort rows and move borders with rows [email protected] New Users to Excel 1 June 4th 09 07:36 AM
Move Rows to Columns DOwens Excel Discussion (Misc queries) 3 November 28th 07 04:15 PM
How do I move up rows below blank rows in an address? goggem Excel Worksheet Functions 0 May 17th 05 04:01 AM
Move Rows & Append James[_36_] Excel Programming 0 April 13th 05 04:18 PM
how to move up and down different rows? Rana Mubasir Mehmood Excel Programming 1 November 25th 04 12:00 AM


All times are GMT +1. The time now is 11:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"