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: 1
Default Change properties of a combobox with VBA


Hi,

I have the following situation in Excel:
I have a worksheet called "Begroting Calc" with comboboxes to select an
option from a list on another sheet called "Rekenblad uitgangspunten
Calc". I have created a macro which makes a copy of both sheets and
renames these sheets to "Begroting WVB" and "Rekenblad uitgangspunten
WVB". It also copies the comboboxes and formulas on these sheets.
The problems a
1) I have 224 comboboxes and by inserting a row in worksheet "Begroting
Calc" (the copied worksheet) it will be 225. So the amount of comboboxes
can change. The macro will have to search for all comboboxes in the
worksheet "Begroting WVB" and change the LinkedCell-properties from
"'Rekenblad uitgangspunten Calc'!D..." to "'Rekenblad uitgangspunten
WVB'!D..." and the ListFillRange-properties from "'Rekenblad
uitgangspunten Calc!C...:C..." to "'Rekenblad uitgangspunten
WVB'!C...:C...". I tried to create a macro myself, but it will only
change the named comboboxes and uses a lot of space (see below).
2) In cells M12 to M224 of worksheet "Begroting Calc" I have these
formulas:
='Rekenblad uitgangspunten Calc'!F3
='Rekenblad uitgangspunten Calc'!F6
='Rekenblad uitgangspunten Calc'!F9
and so on...
These formulas will also have to change to:
='Rekenblad uitgangspunten WVB'!F3
='Rekenblad uitgangspunten WVB'!F6
='Rekenblad uitgangspunten WVB'!F9
and so on...
But by inserting a row in "Begroting Calc" (the copied worksheet) the
range will be M12:M225. So the macro will have to search for all cells
in worksheet "Begroting WVB" with the formula in it.
Can someone help me with these problems? Thanks in advance!


Sub ChangeComboBoxProperties()

Dim ComboBox1 As OLEObject
Dim ComboBox2 As OLEObject
Dim ComboBox3 As OLEObject
Dim ws As Worksheet
Set ws = ActiveSheet

Set ComboBox1 = ws.OLEObjects("ComboBox1")
With ComboBox1
LinkedCell = "'Rekenblad uitgangspunten WVB'!D3"
ListFillRange = "'Rekenblad uitgangspunten WVB'!C3:C5"
End With

Set ComboBox2 = ws.OLEObjects("ComboBox2")
With ComboBox2
LinkedCell = "'Rekenblad uitgangspunten WVB'!D6"
ListFillRange = "'Rekenblad uitgangspunten WVB'!C6:C8"
End With

Set ComboBox3 = ws.OLEObjects("ComboBox3")
With ComboBox3
LinkedCell = "'Rekenblad uitgangspunten WVB'!D9"
ListFillRange = "'Rekenblad uitgangspunten WVB'!C9:C11"
End With

End Sub


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=553618

 
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
comboBox properties cmpcwil2[_30_] Excel Programming 2 June 16th 06 02:27 PM
Change ComboBox properties in VBA? [email protected] Excel Programming 2 January 20th 06 03:34 PM
TextColumn Properties of ComboBox Brett Excel Discussion (Misc queries) 0 October 21st 05 11:26 PM
Setting properties to combobox Stefan[_6_] Excel Programming 2 September 16th 04 12:21 PM
ComboBox ProperTies Dan Gesshel Excel Programming 2 October 17th 03 01:08 AM


All times are GMT +1. The time now is 01:27 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"