Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Charting / December 2006

Tip: Looking for answers? Try searching our database.

Everything works...but can't get it to Loop

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
PBnJGang - 28 Dec 2006 02:04 GMT
I have been able to get everything to do what I need it to do, but when I
added the Do...Until Loop it gets hung up.

Here is what I have so far:

# Dim aRange As Range  
# Set aRange = ActiveCell  
#  
#  
# 'Do Until ActiveCell.Value = ""  
#     ActiveCell.Select  
#     Selection.Cut  
#     aRange.Offset([3], [-1]).Select  'When I add the Do Loop it gets stuck
here!  
#     ActiveSheet.Paste  
#     ActiveCell.Copy  
#      
#     aRange.Offset([0], [1]).Select  
#     Selection.End(xlDown).Offset([0], [-1]).Select  
#     ActiveSheet.Paste  
#     Application.CutCopyMode = False  
#     ActiveCell.Select  
#     Range(Selection, Selection.End(xlUp)).Select  
#     Selection.FillUp  
#     ActiveCell.Select  
#     Selection.End(xlDown).Select  
#     ActiveCell.Select  
#     Selection.Offset([4], [1]).Select  
# 'Loop  
#      
# End Sub  

Any suggestions??? Also, if any of this code can be cleaned up feel free to
offer ideas!

Thanks in advance
Jon Peltier - 28 Dec 2006 13:59 GMT
1. Why do you have brackets around the numbers in your Offsets?
2. Move "Set aRange = ActiveCell" inside the Do loop (right after Do Until)
3. You should try to adjust the code so you aren't selecting cells and
changing the selection and so forth. For example:

> #     ActiveCell.Select
> #     Selection.Cut
> #     aRange.Offset([3], [-1]).Select  'When I add the Do Loop it gets
> stuck here!
> #     ActiveSheet.Paste

becomes

 aRange.Cut aRange.Offset(3, -1)

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______

>I have been able to get everything to do what I need it to do, but when I
> added the Do...Until Loop it gets hung up.
[quoted text clipped - 34 lines]
>
> Thanks in advance
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.