LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Create/copy combo boxes in one range if condition is met in a different range

Based on your excellent advice, I was able to use the code below to
create a macro to create/copy combo boxes in the range B22:B33.
However, I only need to have the combo box show up in column B if there
is data in the same row in column A. In other words, if column A same
row is blank, then I need the macro to stop.

1. What is the code to do this conditional execution?
2. I also want the background color of these combo boxes to be yellow.
What code do I need to insert into my existing code to do that?

Thanks in advance for your assistance.

Dim myOLEObj As OLEObject
Dim myRng As Range
Dim myCell As Range

With ActiveSheet
Set myRng = .Range("b22:b33")
For Each myCell In myRng.Cells

With myCell
Set myOLEObj = .Parent.OLEObjects.Add _
(ClassType:="Forms.ComboBox.1", _
Link:=False, DisplayAsIcon:=False, _
Left:=.Left, Top:=.Top, Width:=.Width, _
Height:=.Height)

End With

With myOLEObj
.LinkedCell = .TopLeftCell.Offset(0, 0) _
.Address(external:=True)
.ListFillRange = Worksheets("Linked Cells").Range
("g2:g9") _
.Address(external:=True)
.Placement = xlMoveAndSize
End With
Next myCell
End With

 
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
Getting Combo boxes to change options based on other Combo boxes. Ancient Wolf New Users to Excel 1 March 27th 09 06:29 PM
RANGE EXCEL copy cell that meets criteria in a range confused Excel Worksheet Functions 3 March 27th 08 01:41 PM
How do I create dependent combo-boxes? ExcelDave Excel Discussion (Misc queries) 3 November 20th 06 02:26 PM
Programmatically create combo boxes Richard[_31_] Excel Programming 1 August 12th 04 03:10 AM
Using SUM with worksheet range selected by two combo boxes fifthhorseman Excel Programming 1 June 18th 04 10:38 PM


All times are GMT +1. The time now is 03:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"