Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 20th, 2003, 10:31 AM
Registered User
Join Date: Jun 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help with Worksheet Change Event

I have the following worksheet change event script:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

If Target = Range("c35") Then

    Application.EnableEvents = False

        Range("m35").Value = ""
        Range("c37").Value = ""

    Application.EnableEvents = True

End If

End Sub

Any time I delete the contents of a cell that is within a merged range of cells, I get a Runtime Error #13. Can anyone explain this and how to avoid it?


Bryan Brassell

Bryan A. Brassell
Old June 24th, 2003, 09:08 AM
Registered User
Join Date: Jun 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts


When you try to put data into merged cells on the spreadsheet itself, you will find you can only address one of the cells. (Try an example: merge A1,B1 and C1: then try to put data into B1!)

I suggest that you unmerge the cells: put your new data in: then remerge them. If the code eludes you, a macro recording will point you down the road.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create event for new worksheet sektor Excel VBA 0 May 28th, 2008 01:48 AM
Change of event using 2 combobox yogeshyl Excel VBA 0 July 31st, 2007 05:02 AM
Event on record change needelp Access VBA 5 October 18th, 2006 07:13 PM
Change Event Help BryanBrassell Excel VBA 4 July 29th, 2004 03:42 PM
Change Event BryanBrassell Excel VBA 0 December 18th, 2003 01:27 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.