Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default Clear Contents

Why does the following not work on merged cells?

Range("DailyHours").ClearContents

When this does

Application.Goto Reference:="DailyHours"
Selection.ClearContents

I must be able to clear the contents of a range without selecting it, how?


Thanks for the help
Richard
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default Clear Contents

Hi,

Try this,

range("DailyHours").MergeArea.clearcontents

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Richard" wrote in message
...
Why does the following not work on merged cells?

Range("DailyHours").ClearContents

When this does

Application.Goto Reference:="DailyHours"
Selection.ClearContents

I must be able to clear the contents of a range without selecting it, how?


Thanks for the help
Richard


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Clear Contents

I assume DailyHours refers to a single cell within a merged area - so try:

Range("DailyHours").MergeArea.ClearContents

which worked for me

--
Regards,
Tom Ogilvy


"Richard" wrote:

Why does the following not work on merged cells?

Range("DailyHours").ClearContents

When this does

Application.Goto Reference:="DailyHours"
Selection.ClearContents

I must be able to clear the contents of a range without selecting it, how?


Thanks for the help
Richard

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default Clear Contents

Tom

DailyHours refers to a range of cells, within which there are merged cells.

Richard

"Tom Ogilvy" wrote:

I assume DailyHours refers to a single cell within a merged area - so try:

Range("DailyHours").MergeArea.ClearContents

which worked for me

--
Regards,
Tom Ogilvy


"Richard" wrote:

Why does the following not work on merged cells?

Range("DailyHours").ClearContents

When this does

Application.Goto Reference:="DailyHours"
Selection.ClearContents

I must be able to clear the contents of a range without selecting it, how?


Thanks for the help
Richard

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default Clear Contents

Andy

thanks for the idea, doesn't seems to work

Cheers
Richard

"Andy Pope" wrote:

Hi,

Try this,

range("DailyHours").MergeArea.clearcontents

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Richard" wrote in message
...
Why does the following not work on merged cells?

Range("DailyHours").ClearContents

When this does

Application.Goto Reference:="DailyHours"
Selection.ClearContents

I must be able to clear the contents of a range without selecting it, how?


Thanks for the help
Richard




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default Clear Contents

In what way does it not work?

Maybe you can provide detail of the range, DailyHours. What cells does it
include?
Which of the cells in the range are merged.

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Richard" wrote in message
...
Andy

thanks for the idea, doesn't seems to work

Cheers
Richard

"Andy Pope" wrote:

Hi,

Try this,

range("DailyHours").MergeArea.clearcontents

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Richard" wrote in message
...
Why does the following not work on merged cells?

Range("DailyHours").ClearContents

When this does

Application.Goto Reference:="DailyHours"
Selection.ClearContents

I must be able to clear the contents of a range without selecting it,
how?


Thanks for the help
Richard



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


Similar Threads
Thread Thread Starter Forum Replies Last Post
clear contents Arne Hegefors Excel Programming 1 June 13th 07 03:39 PM
Macro to clear range contents when cell contents are changed by us Steve E Excel Programming 12 February 22nd 07 09:09 PM
Clear contents Arne Hegefors Excel Programming 3 September 28th 06 05:43 PM
Clear contents SamanthaK Excel Programming 3 June 15th 06 09:05 AM
Clear contents if x is not in the row Mighvik Excel Programming 1 October 5th 04 08:14 PM


All times are GMT +1. The time now is 11:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"