View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Phrank Phrank is offline
external usenet poster
 
Posts: 153
Default Memory Overflow issue (clear worksheet that has Worksheet_Change action)

Hi,

I've got an overflow error that I don't know how to deal with. High
level: I'm clearing all contents and formats from a sheet, and then
copying/pasting all (updated) contents and formats from another
workbook/sheet (first section of code below) The Target worksheet
(the one being cleared and pasted into) has Worksheet_Change code that
I've just added (second bit of code below). When the cells on the
Target sheet are cleared, it triggers the Worksheet_Change event, and
I get the overflow error. Any thoughts as to why, and more
importantly, how to deal with this? Thanks!

With wksSource
wksTarget.Cells.ClearContents
wksTarget.Cells.Interior.Pattern = xlNone
.Cells.Copy wksTarget.Cells(1)
End With 'wksSource


Private Sub Worksheet_Change(ByVal Target As Range)

Dim iCol As Long
Dim iRow As Long
Dim myNotes As String

If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub

[more code here, but it dies at the first line]

Frank