Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default Clearing Merged Cells

Hi,

I have a range of cells that I need to clear before doing other stuff with
them. These cells are formatted in a particular way and some of them are
merged. I am trying to use:

Sheets("mobilisation").Range("h2:n8").Clear

but this is returning an error saying that Excel "cannnot change part of a
merged cell"

As I can both Clear and Delete the content of these cells manually, I assume
that I haven't got the syntax correct to do it in VBA?

Any help would be appreciated.

TIA

Dave
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Clearing Merged Cells

Try

Sheets("mobilisation").Range("h2:n8").MergeArea.Cl ear

HTH,
Barb Reinhardt

"Risky Dave" wrote:

Hi,

I have a range of cells that I need to clear before doing other stuff with
them. These cells are formatted in a particular way and some of them are
merged. I am trying to use:

Sheets("mobilisation").Range("h2:n8").Clear

but this is returning an error saying that Excel "cannnot change part of a
merged cell"

As I can both Clear and Delete the content of these cells manually, I assume
that I haven't got the syntax correct to do it in VBA?

Any help would be appreciated.

TIA

Dave

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default Clearing Merged Cells

Barb,

thanks for the reply. this now throws up:

Run-time error 1004:

Application-defined or object-defined error


As you have probably guessed, I'm no programmer so I don't really understand
what this is trying to tell me.

Dave

"Barb Reinhardt" wrote:

Try

Sheets("mobilisation").Range("h2:n8").MergeArea.Cl ear

HTH,
Barb Reinhardt

"Risky Dave" wrote:

Hi,

I have a range of cells that I need to clear before doing other stuff with
them. These cells are formatted in a particular way and some of them are
merged. I am trying to use:

Sheets("mobilisation").Range("h2:n8").Clear

but this is returning an error saying that Excel "cannnot change part of a
merged cell"

As I can both Clear and Delete the content of these cells manually, I assume
that I haven't got the syntax correct to do it in VBA?

Any help would be appreciated.

TIA

Dave

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Clearing Merged Cells

Try this

Sheets("mobilisation").Range("h2:n8").MergeArea.Un merge


"Risky Dave" wrote in message
...
Barb,

thanks for the reply. this now throws up:

Run-time error 1004:

Application-defined or object-defined error


As you have probably guessed, I'm no programmer so I don't really
understand
what this is trying to tell me.

Dave

"Barb Reinhardt" wrote:

Try

Sheets("mobilisation").Range("h2:n8").MergeArea.Cl ear

HTH,
Barb Reinhardt

"Risky Dave" wrote:

Hi,

I have a range of cells that I need to clear before doing other stuff
with
them. These cells are formatted in a particular way and some of them
are
merged. I am trying to use:

Sheets("mobilisation").Range("h2:n8").Clear

but this is returning an error saying that Excel "cannnot change part
of a
merged cell"

As I can both Clear and Delete the content of these cells manually, I
assume
that I haven't got the syntax correct to do it in VBA?

Any help would be appreciated.

TIA

Dave



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Clearing Merged Cells

I should have included that after the cells are unmerged, you can then clear
them. If you require merged cells in that range, then you will have to
merge them again.

Excel will not let you alter merged cells because it does not know which
part of the cell you really want to change. You have to unmerge them, do
your thing and then merge them again.



"Risky Dave" wrote in message
...
Barb,

thanks for the reply. this now throws up:

Run-time error 1004:

Application-defined or object-defined error


As you have probably guessed, I'm no programmer so I don't really
understand
what this is trying to tell me.

Dave

"Barb Reinhardt" wrote:

Try

Sheets("mobilisation").Range("h2:n8").MergeArea.Cl ear

HTH,
Barb Reinhardt

"Risky Dave" wrote:

Hi,

I have a range of cells that I need to clear before doing other stuff
with
them. These cells are formatted in a particular way and some of them
are
merged. I am trying to use:

Sheets("mobilisation").Range("h2:n8").Clear

but this is returning an error saying that Excel "cannnot change part
of a
merged cell"

As I can both Clear and Delete the content of these cells manually, I
assume
that I haven't got the syntax correct to do it in VBA?

Any help would be appreciated.

TIA

Dave



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
Clearing cells without clearing formulas marsjune68 Excel Discussion (Misc queries) 2 April 10th 09 07:39 PM
Autofit Merged cell Code is changing the format of my merged cells JB Excel Discussion (Misc queries) 0 August 20th 07 02:12 PM
Clearing the Contents of Merged Cells prizm1 New Users to Excel 2 September 10th 05 04:42 AM
Clearing the contents of merged cells Doug Glancy Excel Programming 0 April 23rd 04 08:54 PM
Clearing a merged cell Jon Omar Excel Programming 1 July 15th 03 01:31 AM


All times are GMT +1. The time now is 08:31 PM.

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"