#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Loops


Thanks to the people who answered my last post. Problem 2. I have
written a loop which works but I want it to stop when the activecell
has the value "fuggle". It stops for a few seconds at cell fuggle then
goes round again. The code is below any ideas?

Sub Customer()
'
' Customer Macro
' Macro recorded 07/07/2005 by James Fuggle
'

'
Sheets.Add
ActiveSheet.Name = "Customers"
Sheets("Duration and Consumables Bookin").Select

Do While ActiveCell < "fuggle"
Cells.Find(What:="customer", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
_
MatchCase:=False, SearchFormat:=False).Activate
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Customers").Select
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveSheet.Paste
Sheets("Duration and Consumables Bookin").Select
ActiveCell.Offset(1, 0).Range("A1").Select
Loop
End Sub


--
fugfug
------------------------------------------------------------------------
fugfug's Profile: http://www.excelforum.com/member.php...o&userid=24950
View this thread: http://www.excelforum.com/showthread...hreadid=385196

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Loops

Have a look in vba HELP index for find and then findnext. There is a good
example. While you're at it, eliminate the selections.

--
Don Guillett
SalesAid Software

"fugfug" wrote in
message ...

Thanks to the people who answered my last post. Problem 2. I have
written a loop which works but I want it to stop when the activecell
has the value "fuggle". It stops for a few seconds at cell fuggle then
goes round again. The code is below any ideas?

Sub Customer()
'
' Customer Macro
' Macro recorded 07/07/2005 by James Fuggle
'

'
Sheets.Add
ActiveSheet.Name = "Customers"
Sheets("Duration and Consumables Bookin").Select

Do While ActiveCell < "fuggle"
Cells.Find(What:="customer", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
_
MatchCase:=False, SearchFormat:=False).Activate
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Customers").Select
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveSheet.Paste
Sheets("Duration and Consumables Bookin").Select
ActiveCell.Offset(1, 0).Range("A1").Select
Loop
End Sub


--
fugfug
------------------------------------------------------------------------
fugfug's Profile:

http://www.excelforum.com/member.php...o&userid=24950
View this thread: http://www.excelforum.com/showthread...hreadid=385196



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Loops

Sub Customer()
'
' Customer Macro
' Macro recorded 07/07/2005 by James Fuggle
'

'
Sheets.Add
ActiveSheet.Name = "Customers"
Sheets("Duration and Consumables Bookin").Select
Range("A1").Select
Cells.Find(What:="fruggle", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False, SearchFormat:=False).Activate
rw = ActiveCell.Row
Range("A1").Select
Do While ActiveCell.Row < rw
Cells.Find(What:="customer", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False, SearchFormat:=False).Activate
If ActiveCell.Row = rw Then Exit Do
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Customers").Select
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveSheet.Paste
Sheets("Duration and Consumables Bookin").Select
ActiveCell.Offset(1, 0).Range("A1").Select
Loop
End Sub

--
Regards,
Tom Ogilvy

"fugfug" wrote in
message ...

Thanks to the people who answered my last post. Problem 2. I have
written a loop which works but I want it to stop when the activecell
has the value "fuggle". It stops for a few seconds at cell fuggle then
goes round again. The code is below any ideas?

Sub Customer()
'
' Customer Macro
' Macro recorded 07/07/2005 by James Fuggle
'

'
Sheets.Add
ActiveSheet.Name = "Customers"
Sheets("Duration and Consumables Bookin").Select

Do While ActiveCell < "fuggle"
Cells.Find(What:="customer", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
_
MatchCase:=False, SearchFormat:=False).Activate
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Customers").Select
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveSheet.Paste
Sheets("Duration and Consumables Bookin").Select
ActiveCell.Offset(1, 0).Range("A1").Select
Loop
End Sub


--
fugfug
------------------------------------------------------------------------
fugfug's Profile:

http://www.excelforum.com/member.php...o&userid=24950
View this thread: http://www.excelforum.com/showthread...hreadid=385196



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Loops


Thanks alot, works now

--
fugfu
-----------------------------------------------------------------------
fugfug's Profile: http://www.excelforum.com/member.php...fo&userid=2495
View this thread: http://www.excelforum.com/showthread.php?threadid=38519

Reply
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
Do loops within Do loops Linking to specific cells in pivot table Excel Programming 4 April 14th 05 08:47 AM
Using For - Next Loops in VB Biomed New Users to Excel 4 March 22nd 05 07:12 PM
Loops Hannes Excel Programming 3 December 29th 04 02:33 PM
for each loops adncmm1980[_3_] Excel Programming 1 October 4th 04 12:56 PM
Loops etc. Jonathan Vickers Excel Programming 6 February 28th 04 05:35 PM


All times are GMT +1. The time now is 01:49 PM.

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

About Us

"It's about Microsoft Excel"