UnMerge Cells with Macro Language/VB Commands in SAS

joeyeng

New Member
Joined
May 19, 2003
Messages
12
I need to use the excel macro language functions (found in macrofun.exe) in order to unmerge cells. The alignment function (the equivalent of format>cells>alignment tab) in the macro language has the following syntax:

ALIGNMENT(horiz_align, wrap, vert_align, orientation, add_indent)

It appears the alignment function in the macro language does not have an option to unmerge cells. (In excel, I would simply uncheck the Merge Cells option to do this.) Does anyone know how to unmerge cells with the macro language?

Any help would be much appreciated!
 
I think Nate is on the right track... maybe this works ?

put 'gobjExcel.Selection.TextToColumns Range("G1"),1,1,False,True,False,False,False,False,False,Array(1, 2)'

its the same code you used, but without Excel constants...
 
Upvote 0

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
joeyeng said:
Nate,

I get the following error:

TextToColumns method of Range class failed

Any ideas?

Joey

Try the revised code above, I added the object and sheet references with both the original and destination ranges... (I snuck my edit in there :LOL: )
 
Upvote 0
joeyeng said:
Juan,

I tried your code and got the following error:

Type mismatch: 'Range'

Joey

The destination must have the object as well, e.g.,

gobjExcel.range("g1")

As you're using Excel objects on the late bind.

Also, it doesn't hurt to define your sheet...
 
Upvote 0
Nate,

Your revised code generated the following error:

Object doesn't support this property or method: 'sheets(...).g1'

Joey
 
Upvote 0
Hmmm, you can pull this off in Access... Maybe try the range:

put 'gobjExcel.sheets(1).range("g:g").TextToColumns gobjExcel.sheets(1).range("g1"),1,1,False,True';

If that doesn't want to fire, try dropping sheets(1).
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,186
Members
449,071
Latest member
cdnMech

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
Back
Top