LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Locks up at end of Sub


I've simplified my code if someone can take a look at it.

If I do the first copy and paste manually (cols E:H), Excel clocks fo
almost a minute, but then functions normally. If I step through th
program, I get no problems until I reach the Exit Sub statement, an
then it freezes. Anyone ever experience anything like this?

Thanks again,
Ryan

=========================================
Sub FactorFormatAfterBB()

' Find range to Autofill

Range("A1").Select
If IsEmpty(Range("A6000")) = False Then
RowOffset = 5999
Range("A6000").Select
Else
If IsEmpty(Range("A3000")) = False Then
RowOffset = 2999
Range("A3000").Select
End If
End If

Do While IsEmpty(ActiveCell) = False
ActiveCell.Offset(R + 1, C).Select
RowOffset = RowOffset + 1
Loop

Range("E2:H" & RowOffset).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone
SkipBlanks _
:=True, Transpose:=False

Range("A2").Select
Selection.Sort Key1:=Range("F2"), Order1:=xlAscending
Key2:=Range("A2") _
, Order2:=xlAscending, Header:=xlYes, OrderCustom:=1
MatchCase:=False _
, Orientation:=xlTopToBottom

Range("I1").Select
ActiveCell.FormulaR1C1 = "CAMRA Factor Dt"
Columns("I:I").ColumnWidth = 15.57
Range("j1").Select
ActiveCell.FormulaR1C1 = "N/A Chk"
Range("k1").Select
ActiveCell.FormulaR1C1 = "Past Chk"

Range("C:D").Select
Selection.Delete Shift:=xlToLeft
Range("E8").Select
Range("A1").Select
Selection.AutoFilter

Range("G2").Select
ActiveCell.FormulaR1C1 = "Err!"
Range("H2").Select
ActiveCell.FormulaR1C1 = "DELETE"
Range("I2").Select
ActiveCell.FormulaR1C1 = "Out-of-date"
Range("G2:I2").Select
Selection.AutoFill Destination:=Range("G2:I" & RowOffset)
Range("G2:I" & RowOffset).Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone
SkipBlanks _
:=True, Transpose:=False

Application.DisplayAlerts = False
Range("Z1").Select
ActiveCell.FormulaR1C1 = _

"=CONCATENATE(""h:\dataclnp\factors\"",MONTH(TODAY ()),DAY(TODAY()),YEAR(TODAY()),""bb.xls"")"
SaveLoc = Range("Z1")
ActiveWorkbook.SaveAs Filename:=SaveLoc, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

Application.DisplayAlerts = True

'--An attempt to end the Sub without the locking

If RowOffset 0 Then Exit Sub

End Su

--
Hugenstei
-----------------------------------------------------------------------
Hugenstein's Profile: http://www.excelforum.com/member.php...fo&userid=2273
View this thread: http://www.excelforum.com/showthread.php?threadid=46721

 
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
2003 excel locks up rojo645 Excel Discussion (Misc queries) 3 March 24th 07 09:01 PM
Save as locks up Excel Greg Q Excel Discussion (Misc queries) 1 April 24th 06 07:34 PM
pcanywhere locks up excel ccart123 Excel Discussion (Misc queries) 0 August 23rd 05 08:41 PM
Excel locks up David Turner Excel Programming 2 November 12th 03 10:07 PM
Delete row and Excel locks up Stuart[_5_] Excel Programming 1 July 15th 03 03:38 PM


All times are GMT +1. The time now is 03:15 PM.

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"