L
Linking to specific cells in pivot table
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
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