View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
joel joel is offline
external usenet poster
 
Posts: 9,101
Default VBA - Run time error when modules combined???

Here is how I would write the code (see below). I avoid the select method
like you did below. I specifically reference each sheet and range as
required to avoid mistakes like you jusdt made.

The main problem is with the statement Range("x" & lastrow + 1).Select. It
was selectiung the wrong worksheet. You had Sheets("Rift_raid") selected but
the last row was from sheet Worksheets("Last_Raid_Report").

Why do you have False as a string with double quotes around False?

Sub Enter_false()
Dim testrange

' Application.ScreenUpdating = False

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

Do While lastrow 3
testrange = "A" & lastrow
If .Range("A" & lastrow).Value< False Then
.Range("A" & lastrow).Value = False
End If
lastrow = lastrow - 1
Loop
end with

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

Application.CutCopyMode = False

End Sub


"Madduck" wrote:



I've done some more testing...

the error is definately in the Enter_False module...

I have seperated all the modules out, it works sometime , but errors alot..

The last run time error I just recieved is

Run-time error '-2147417848 (80010108)

Automation error
The object invoked has disconnected from its clients.


I hit "Debug" and then get the other Run-time error Value of object Range
failed.. as already stated....

maybe ( hopefully) this gives you more to go by?