#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default HEEEEEEEELP

Excel is no longer my friend. I have written some pretty cool code
(albeit of probably a very basic nature) and it sometimes works and
sometimes does not. As far as a basic user such as myself can see there
is absolutely no difference in the circumstances when it works and when
it does not. Is there some sort of cache thing that needs to be cleared
down (and can be through some code) that anyone knows of?

Many thanks in advance.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default HEEEEEEEELP

So are you going to show us your pretty cool code, or keep it a secret?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default HEEEEEEEELP

Sorry- my assumption is based on the fact that the code works sometimes
ergo there's nothing wrong with it but somthing wrong with some cache
or some condition outside the code. Any idea about some sort of cache
thing?

If not I can paste the full code.

Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default HEEEEEEEELP

OK- it would make sense to put the Run-time error in I guess...
'-2147417848 (80010108)':

Automation error
THe object invoked has disconnected from its clients.

Paha??

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default HEEEEEEEELP

Start at the beginning. Post the code.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"solomon_monkey" wrote in message
oups.com...
Sorry- my assumption is based on the fact that the code works sometimes
ergo there's nothing wrong with it but somthing wrong with some cache
or some condition outside the code. Any idea about some sort of cache
thing?

If not I can paste the full code.

Thanks.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default HEEEEEEEELP

Sub CashCheques()
'
'

'
Application.ScreenUpdating = False

result = MsgBox("Did you mean to press the 'CASH & CHEQUES' Button?", _
vbYesNoCancel, "CASH & CHEQUES")
If result = vbYes Then
GoTo continue
Else
MsgBox "'CASH & CHEQUES' cancelled", vbOKOnly, "CASH & CHEQUES"
GoTo exit1
End If

continue:

Sheets("Monthly Receipts").Copy After:=Sheets(2)
ActiveSheet.Unprotect

Range("A9:E9").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1
Selection.AutoFilter
Selection.AutoFilter

Dim num As Long

Selection.AutoFilter Field:=5, Criteria1:="="
ActiveSheet.AutoFilter.Range.Select
Range(Selection, Selection.End(xlDown)).Select
Selection.EntireRow.Delete

If Range("B9") = 0 Then
MsgBox "No Cash transactions this period", vbOKOnly, "Cash"
GoTo continue1
Else
End If

Range("A9:E9").Select

If Range("B10") = 0 Then
GoTo continue2
Else
Range(Selection, Selection.End(xlDown)).Select
End If

continue2:

Selection.Copy
Sheets("Cash").Select
Range("A9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

MsgBox Range("C4") & " Cash transactions this period", vbOKOnly, "Cash"

continue1:

Application.DisplayAlerts = False
Sheets("Monthly Receipts (2)").Delete
Application.DisplayAlerts = True

Sheets("Cash").Select

Dim rng As Range
Set rng = Range("A7").End(xlDown)

If rng = Range("A8") Then
rng.Offset(1, 0).Select
Else
rng.Offset(0, 6).Select
End If

Sheets("Monthly Receipts").Copy After:=Sheets(3)
ActiveSheet.Unprotect

Range("A9:E9").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1
Selection.AutoFilter
Columns("E:E").Delete
Selection.AutoFilter

'HERE

Selection.AutoFilter Field:=5, Criteria1:="="
ActiveSheet.AutoFilter.Range.Select
Range(Selection, Selection.End(xlDown)).Select
Selection.EntireRow.Delete

If Range("B9") = 0 Then
MsgBox "No Cheque transactions this period", vbOKOnly, "Cheques"
GoTo continue3
Else
End If

Range("A9:E9").Select

If Range("B10") = 0 Then
GoTo continue4
Else
Range(Selection, Selection.End(xlDown)).Select
End If

If Range("B9") = 0 Then
MsgBox "No Cheque transactions this period", vbOKOnly, "Cheques"
GoTo continue3
Else
End If

Range("A9:E9").Select

If Range("B10") = 0 Then
GoTo continue4
Else
Range(Selection, Selection.End(xlDown)).Select
End If

continue4:

Selection.Copy
Sheets("Cheques").Select
Range("A9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

MsgBox Range("C4") & " Cheque transactions this period", vbOKOnly,
"Cheques"

continue3:

Application.DisplayAlerts = False
Sheets("Monthly Receipts (2)").Delete
Application.DisplayAlerts = True

Sheets("Cheques").Select

Dim rng2 As Range
Set rng2 = Range("A7").End(xlDown)

If rng2 = Range("A8") Then
rng2.Offset(1, 0).Select
Else
rng2.Offset(0, 6).Select
End If

Sheets("Monthly Receipts").Select

exit1:

Sheets("Monthly Receipts").Select

Application.ScreenUpdating = True

End Sub

I have indicated where it runs the error. It is the second time I copy
the same worksheet. I do not understand why it does not always work or
always fail.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default HEEEEEEEELP

http://support.microsoft.com/default...;en-us;q297218

This is no help...

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default HEEEEEEEELP

Try qualifying all of your ranges by explicitly including the worksheet.
Not doing so is asking for problems.

Tim

--
Tim Williams
Palo Alto, CA


"solomon_monkey" wrote in message
oups.com...
Sub CashCheques()
'
'

'
Application.ScreenUpdating = False

result = MsgBox("Did you mean to press the 'CASH & CHEQUES' Button?", _
vbYesNoCancel, "CASH & CHEQUES")
If result = vbYes Then
GoTo continue
Else
MsgBox "'CASH & CHEQUES' cancelled", vbOKOnly, "CASH & CHEQUES"
GoTo exit1
End If

continue:

Sheets("Monthly Receipts").Copy After:=Sheets(2)
ActiveSheet.Unprotect

Range("A9:E9").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1
Selection.AutoFilter
Selection.AutoFilter

Dim num As Long

Selection.AutoFilter Field:=5, Criteria1:="="
ActiveSheet.AutoFilter.Range.Select
Range(Selection, Selection.End(xlDown)).Select
Selection.EntireRow.Delete

If Range("B9") = 0 Then
MsgBox "No Cash transactions this period", vbOKOnly, "Cash"
GoTo continue1
Else
End If

Range("A9:E9").Select

If Range("B10") = 0 Then
GoTo continue2
Else
Range(Selection, Selection.End(xlDown)).Select
End If

continue2:

Selection.Copy
Sheets("Cash").Select
Range("A9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

MsgBox Range("C4") & " Cash transactions this period", vbOKOnly, "Cash"

continue1:

Application.DisplayAlerts = False
Sheets("Monthly Receipts (2)").Delete
Application.DisplayAlerts = True

Sheets("Cash").Select

Dim rng As Range
Set rng = Range("A7").End(xlDown)

If rng = Range("A8") Then
rng.Offset(1, 0).Select
Else
rng.Offset(0, 6).Select
End If

Sheets("Monthly Receipts").Copy After:=Sheets(3)
ActiveSheet.Unprotect

Range("A9:E9").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1
Selection.AutoFilter
Columns("E:E").Delete
Selection.AutoFilter

'HERE

Selection.AutoFilter Field:=5, Criteria1:="="
ActiveSheet.AutoFilter.Range.Select
Range(Selection, Selection.End(xlDown)).Select
Selection.EntireRow.Delete

If Range("B9") = 0 Then
MsgBox "No Cheque transactions this period", vbOKOnly, "Cheques"
GoTo continue3
Else
End If

Range("A9:E9").Select

If Range("B10") = 0 Then
GoTo continue4
Else
Range(Selection, Selection.End(xlDown)).Select
End If

If Range("B9") = 0 Then
MsgBox "No Cheque transactions this period", vbOKOnly, "Cheques"
GoTo continue3
Else
End If

Range("A9:E9").Select

If Range("B10") = 0 Then
GoTo continue4
Else
Range(Selection, Selection.End(xlDown)).Select
End If

continue4:

Selection.Copy
Sheets("Cheques").Select
Range("A9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

MsgBox Range("C4") & " Cheque transactions this period", vbOKOnly,
"Cheques"

continue3:

Application.DisplayAlerts = False
Sheets("Monthly Receipts (2)").Delete
Application.DisplayAlerts = True

Sheets("Cheques").Select

Dim rng2 As Range
Set rng2 = Range("A7").End(xlDown)

If rng2 = Range("A8") Then
rng2.Offset(1, 0).Select
Else
rng2.Offset(0, 6).Select
End If

Sheets("Monthly Receipts").Select

exit1:

Sheets("Monthly Receipts").Select

Application.ScreenUpdating = True

End Sub

I have indicated where it runs the error. It is the second time I copy
the same worksheet. I do not understand why it does not always work or
always fail.



Reply
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



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