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: 64
Default Macro getting stuck

Hi - I have multiple macros running back to back on the click event of a
button -- Excel seems to be getting stuck at the beginning of the last macro.
What's happening is that at the bottom of Excel, "Cell" shows up with a
bunch of blue bars prior to getting to the last macro (looks like Excel is
updating cells?) -- Excel moves to the last macro which starts by copying all
cells from one sheet and pasting to another sheet -- it is at this point that
Excel fails to move on -- specifically, Excel pastes the cells onto the new
sheet but fails to move on (the "Cell" with the blue bars at the bottom still
shows).

I tried the "Wait" function for 60 seconds (inserted this into the second to
last macro), but this doesn't help...any ideas on what might be causing this
problem and how to get around it? Below is the code for the last two macros
(again, Excel's getting stuck at the beginning of the last one).

Sub textformat()

Dim textformatcell
Dim newHour
Dim newMinute
Dim newSecond
Dim waitTime

Sheets("Cntrywd Lookups").Select
Range("A11").Select

Do
Sheets("Cntrywd Lookups").Select
ActiveCell.Offset(1, 0).Select
Set textformatcell = ActiveCell

Sheets("Cntrywd Rate Sum step 1").Select

Cells.Find(What:=textformatcell, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=True, SearchFormat:=False).Activate
Selection.Font.Bold = True

If ActiveCell.Value = "PROGRAM DETAILS" Then
Exit Do

End If

Loop

Cells.Find(What:="PayOption Adjustments", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=True, SearchFormat:=False).Activate

ActiveCell.Offset(1, 0).Select
Selection.End(xlToRight).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight

newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 60
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime


End Sub

Sub cntryformula()

Dim cntrydayrange
Dim cntryreference

Sheets("Cntrywd Rate Sum step 1").Select
Cells.Select
Selection.Copy

Sheets("Cntrywd Rate Sum - color coded").Select
Cells.Select
ActiveSheet.Paste

Sheets("Cntrywd Lookups").Select
Range("A1").Select

Do

Sheets("Cntrywd Lookups").Select
Set cntryxx = ActiveCell.Offset(1, 0)
ActiveCell.Offset(1, 0).Select

Sheets("Cntrywd Rate Sum - color coded").Select
Cells.Find(What:=cntryxx, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Cells.Find(What:="day", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

Set cntryreference = ActiveCell.Offset(1, 0)

Range(Selection, Selection.End(xlToRight)).Select
Set cntrydayrange = ActiveWindow.RangeSelection

Sheets("Worksheet Formulas").Select
Cells.Find(What:="Countrywide Day Adjustment Formula",
After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, 1).Copy

Sheets("Cntrywd Rate Sum - color coded").Select
cntrydayrange.Select
ActiveSheet.Paste

Sheets("Worksheet Formulas").Select
Cells.Find(What:="Countrywide Rate Adjustment Formula",
After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, 1).Copy

Sheets("Cntrywd Rate Sum - color coded").Select
cntryreference.Select

Selection.End(xlToRight).Select
Selection.End(xlDown).Select
Range(Selection, cntryreference).Select
ActiveSheet.Paste

If cntryxx = "NonConf ARM 6m LIB IO w/3y Prepay" Then
Exit Do
End If

Loop

End Sub
 
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
Excel Macro Security stuck on Low MSullivan Excel Discussion (Misc queries) 0 September 10th 09 04:08 PM
Sorry but i am stuck again KODIAK BEAR New Users to Excel 5 October 1st 07 08:46 PM
Still stuck on macro... chip_pyp Excel Discussion (Misc queries) 2 March 28th 06 10:11 PM
stuck on final prat of spreadsheet "macro copying cells" alan_bourne[_18_] Excel Programming 4 November 17th 03 09:32 PM
HELP! Macro stuck-"Invalid Object" Ed[_9_] Excel Programming 1 July 25th 03 12:06 AM


All times are GMT +1. The time now is 01:54 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"