View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Simple macro (ClearContent) freezes Excel

Is your code in a Worksheet module, eg activated by a Worksheet ActiveX
control. If so and you are using Excel97 change the TakeFocusOnClick
property of the CommandButton to False. In all versions, if
Sheets("adjustment") is not the sheet containing the commandbutton this line
will fail

Range("B9:J25").Select

unless you change it to
Sheets("adjustment").Range("B9:J25").Select

But if your macro is in a normal module not sure what the problem is, try

Sheets("Sheet2").Range("B9:J25").ClearContents

Regards,
Peter T

"bokodilaszlo"
wrote in message
news:bokodilaszlo.24ce00_1141806602.2868@excelforu m-nospam.com...

Hi,

I have this very simple macro:

Sheets("adjustment").Select
Range("B9:J25").Select
Application.CutCopyMode = False
Selection.ClearContents

Before I run this macro the following things are happening:
- datas are pasted into a different sheet
- these datas are copied into B9:J25

When the destination area contains data then this macro freezes Excel.
If there are no data then it runs "smoothly" :) (It also runs when I
put data manually into those cells)
What should I do to make this macro work?

Thanks,

Laszlo


--
bokodilaszlo
------------------------------------------------------------------------
bokodilaszlo's Profile:

http://www.excelforum.com/member.php...o&userid=32250
View this thread: http://www.excelforum.com/showthread...hreadid=520012