View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Shawn Shawn is offline
external usenet poster
 
Posts: 271
Default Make a combobox equal to part of a cell value

I am wanting to add to it. I basically have a combo box that I want
preloaded with data when it opens. It will tie back to data in a
spreadsheet. It has been simple enough to accomplish up until the scenerio
listed below.
--
Thanks
Shawn


"Rick Rothstein (MVP - VB)" wrote:

I have a cell in Sheets.(Sheet1).Range ("A1") where the content has several
digits a "/" several more digits and a "/" and then several more digits.

I want a VBA that will make usftest.cmbx1.value = equal to what ever value
is to the left of the first "/".

I want a VBA also that will make usftest.cmbx2 = to whatever value is
between the two "/"s.

A final VBA to make usftest.cmbx3 = to what ever value is to the right of
the second "/".


I'm not 100% sure what you mean by "make a combobox equal to..." (do you
want to find an item in ComboBox or add an item to it?), but you can process
the contents of the A1 cell like this...

Dim Fields() As String
Fields = Split(Sheets("Sheet1").Range("A1").Value, "/")
BeforeFirstSlash = Fields(0)
BetweenTwoSlashes = Fields(1)
AfterSecondSlash = Fields(2)

Rick