Thread: Looping
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
David David is offline
external usenet poster
 
Posts: 153
Default Looping

This is sort of simple, but it is a start, if you have
not used VB. It just makes a sort of copy of what already
exists.
Sub Macro1()
Do While ActiveCell.Value < ""
ActiveCell.Offset(1, 0).Select
ActiveCell.Range("A1:B1").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
Selection.End(xlDown).Select
If ActiveCell.Row = 65536 Then
Range("A1").Select
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveSheet.Paste
Else
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveSheet.Paste
End If
Sheets("Sheet1").Select
Application.CutCopyMode = False
'ActiveCell.Offset(1, 0).Range("A1:B1").Select
Loop
Sheets("Sheet1").Select
End Sub

-----Original Message-----
*** post for FREE via your newsreader at

post.newsfeed.com ***

Hello,

I have a spreadsheet that is essentially a database of

employees and
their weekly schedules. I am trying to write a macro

that will loop
through the entire sheet taking an employee and their

information one row
at a time. I don't really know VBA at all, but I (hope

I) am competent
enough to pick it up quickly.

This is pseudocode for what I want:

while ( another_row ) {
read ( name );
read ( schedule );
write_to_file ( name, schedule );
}

Thanks!

Andrew


-----= Posted via Newsfeed.Com, Uncensored Usenet News

=-----
http://www.newsfeed.com - The #1 Newsgroup Service in

the World!
-----== 100,000 Groups! - 19 Servers! - Unlimited

Download! =-----

.