Basic excel vba problem

djurmann

Board Regular
Joined
Jan 13, 2006
Messages
246
Hi folks,

I am trying to unmerge some cells in VBA....the code I have is this

Range("a3:b1433").Select.UnMerge

It does not work giving a runtime '424' object required response. What I wonder is what does this mean and why doesn't the code work?

Many thnaks,

Danny
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

GlennUK

Well-known Member
Joined
Jul 8, 2002
Messages
11,547
Why have you got "Select" in your statement. You aren't trying to select the range.
 

djurmann

Board Regular
Joined
Jan 13, 2006
Messages
246
Hi Glenn,

What I am trying to do ultimately is this. Column a is merged into three rwo blocks e.g. a3:a5 is merged. a6:a8 is merged. I want to unmerge these cells, copy the text from cell a3 to a4 and a5. copy the text from a6 to a7 and a8, sort the column and then remerge the cells. I figured a good start would be to select the range and unmerge it.

Danny
 

djurmann

Board Regular
Joined
Jan 13, 2006
Messages
246
sorted the unmerge :)

It needed to be

range("a3:b1433").Select
Selection.UnMerge
 

GlennUK

Well-known Member
Joined
Jul 8, 2002
Messages
11,547
I figured a good start would be to select the range and unmerge it.
... that's 2 actions, which you are trying to do in one statement.

For the record, most Excel actions can be performed without having to do a Select beforehand. So:
Code:
Range("a3:b1433").UnMerge
would have been a better start.
 

Forum statistics

Threads
1,144,528
Messages
5,724,857
Members
422,586
Latest member
nassardewa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top