4 Replies - 2062 Views - Last Post: 05 April 2009 - 06:21 PM Rate Topic: -----

#1 Caprica6  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 30-March 09

Split a cell in VBA

Posted 03 April 2009 - 03:50 AM

Hi,

I want to be able to split a cell if there is already text in it. I am sure this can be done but can not find any code to do it.

Can someone point me in the right direction ?

Thanks
:)
Is This A Good Question/Topic? 0
  • +

Replies To: Split a cell in VBA

#2 Caprica6  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 30-March 09

Re: Split a cell in VBA

Posted 03 April 2009 - 04:11 AM

I have tried

Selection.Cells.Split NumRows:=1, NumColumns:=3, _
		MergeBeforeSplit:= True



but I get the error "object does not support this property or method"
Was This Post Helpful? 0
  • +
  • -

#3 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 92
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Re: Split a cell in VBA

Posted 03 April 2009 - 05:07 AM

mhm... where is the error at?

Also.

How do you want it to be split? Not really getting that.
Was This Post Helpful? 0
  • +
  • -

#4 Caprica6  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 30-March 09

Re: Split a cell in VBA

Posted 03 April 2009 - 05:27 AM

sorry not feeling well today :-(

What I am doing is if the user right clicks on a cell in the worksheet I display a form for the user to select something from a combobox.

If there is text already in the cell I want to retain the existing text, split the cell and add the new text to one of the split cells.

I get the error object does not support this method on this line of code

Sheet1.Columns.Cells(intCurrRow, intCurrColumn).Split 1, 1, True


Now I know this means that this method is not in the object collection so I am not sure what the code should be.

I am using Office 2003.

Hope this is a bit clearer let me know if not.

Thanks
Was This Post Helpful? 0
  • +
  • -

#5 June7  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 104
  • View blog
  • Posts: 904
  • Joined: 09-December 08

Re: Split a cell in VBA

Posted 05 April 2009 - 06:21 PM

According to Excel help you cannot split individual cells. You can merge cells and then later using VBA code unmerge them. Sounds like you simply need to structure your worksheet with cells intended to be populated with the user-selected data.

Instead of popping up a form with a combo box you could use Data Validation, which is a property of the specific cell where you want the data to display.

This post has been edited by June7: 05 April 2009 - 06:24 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1