View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Madduck Madduck is offline
external usenet poster
 
Posts: 35
Default VBA - Run time error when modules combined???

Thanks Joel..

I'm happy to post the lot... but its quite large, so I'll try and pick what
I think are the relevant sections...


* note I added

lastrow = Worksheets("Rift_raid").Range("A200").End(xlUp).Ro w
Range("A" & lastrow + 1).Select
Application.CutCopyMode = False
after each subroutine call to try and stop the error... it did not work..

Hopefully this all makes sense... thanks in advance for your help...

--------------------------------------------------------------------
Sub update_lists()

Application.ScreenUpdating = False

Enter_false
lastrow = Worksheets("Rift_raid").Range("A200").End(xlUp).Ro w
Range("A" & lastrow + 1).Select
Application.CutCopyMode = False

Find_and_Clear
lastrow = Worksheets("Rift_raid").Range("A200").End(xlUp).Ro w
Range("A" & lastrow + 1).Select
Application.CutCopyMode = False

Re_Insert_non_winners
lastrow = Worksheets("Rift_raid").Range("A200").End(xlUp).Ro w
Range("A" & lastrow + 1).Select
Application.CutCopyMode = False

Move_up
lastrow = Worksheets("Rift_raid").Range("A200").End(xlUp).Ro w
Range("A" & lastrow + 1).Select
Application.CutCopyMode = False

Re_Insert_Winners
lastrow = Worksheets("Rift_raid").Range("A200").End(xlUp).Ro w
Range("A" & lastrow + 1).Select
Application.CutCopyMode = False

Application.ScreenUpdating = True

End Sub
--------------------------------------------------------------------
**** Note .. this enters "FALSE" into the linked cell of a tick box... the
tick box drives the subroutine In_raid() ... I think by entering False in
the linked cell it is the same as clicking the tickbox, well at least it
seems to work that way ****

Sub Enter_false()
Dim testrange

' Application.ScreenUpdating = False

Sheets("Rift_raid").Select
lastrow = WorksheetFunction.CountA(Range("A:A")) + 3

Do While lastrow 3
testrange = "A" & lastrow
If Worksheets("Rift_raid").Cells(lastrow, 1).Value = "False" Then

Else
Worksheets("Rift_raid").Cells(lastrow, 1).Value = "False"
'Range("A" & lastrow).Value = "FALSE"
End If
lastrow = lastrow - 1
Loop

lastrow = Worksheets("Last_Raid_Report").Range("A28").End(xl Up).Row
Range("x" & lastrow + 1).Select

Application.CutCopyMode = False


End Sub
-----------------------------------------------------
*****Note: this is an example of the tickbox code *****

Private Sub twentyseven_Click()

strName = Range("C30")
strLogic = Range("A30")
IntNameset = Range("B30")
strPaste = Range("J30")
in_raid
End Sub
----------------------------------------------------------

Sub in_raid()

Dim lastrow As Long

lastrow = 350

' Application.ScreenUpdating = False

If strLogic = False Then
If Worksheets("Rift_raid").Range("k:k").Find(What:=st rName,
After:=[K1], LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows,
SearchDirection:=xlNext, MatchCase:=True) Is Nothing Then

Else
Cells(Worksheets("Rift_raid").Range("k:k").Find(Wh at:=strName,
After:=[K1], LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows,
SearchDirection:=xlNext, MatchCase:=True).Row, 10).Value = ""
Cells(Worksheets("Rift_raid").Range("k:k").Find(Wh at:=strName,
After:=[K1], LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows,
SearchDirection:=xlNext, MatchCase:=True).Row, 11).Value = ""
End If

Else
lastrow = Worksheets("Rift_raid").Range("J200").End(xlUp).Ro w

If lastrow = 1 Then
Worksheets("Rift_raid").Range("J200").End(xlUp).Of fset(3, 0) =
IntNameset
Worksheets("Rift_raid").Range("J200").End(xlUp).Of fset(0, 1) =
strName
Else
Worksheets("Rift_raid").Range("J200").End(xlUp).Of fset(1, 0) =
IntNameset
Worksheets("Rift_raid").Range("J200").End(xlUp).Of fset(0, 1) =
strName
End If
End If

Application.CutCopyMode = False

Range("j4:k200").Select

***** NOTE: This next line is where the Run time error seems to occur *****

Selection.Sort Key1:=Range("j4"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers
Worksheets("Rift_raid").Range("J200").End(xlUp).Se lect

Application.ScreenUpdating = True

End Sub

------------------------------------------------------------------------------

"Joel" wrote:

Post the code.