Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 271
Default Make a combobox equal to part of a cell value

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 "/".

Please help.



--
Thanks
Shawn
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Make a combobox equal to part of a cell value

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Make a combobox equal to part of a cell value

You can load the ComboBoxes up using code something like this...

Dim R As Range
Dim Fields() As String
For Each R In Range("A1:A6")
Fields = Split(R.Value, "/")
cmbx1.AddItem Fields(0)
cmbx2.AddItem Fields(1)
cmbx3.AddItem Fields(2)
Next

where I assume the original slash-delimited values are in A1:A6 for this
example (change the range to that where your data is).

Rick



"Shawn" wrote in message
...
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



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
can I make cell "yes" equal 1, "no" equal 0 can I make cell yes equal 1, no equa Excel Discussion (Misc queries) 4 April 22nd 23 06:09 AM
make cell length always equal 10 Little pete Excel Discussion (Misc queries) 6 January 31st 07 04:31 PM
How do I make a worksheet name equal to a cell tim m Excel Programming 2 October 23rd 06 06:09 PM
How do I make a cell equal to another cells value and not it's fo. TroutKing Excel Worksheet Functions 2 January 17th 05 06:15 PM
How do I make one cell equal to another Deb Blackshaw Excel Worksheet Functions 2 December 20th 04 12:29 AM


All times are GMT +1. The time now is 09:23 AM.

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"