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 Rename combobox with a macro


Hi,

In column L rows 12 to 242 I have ComboBox1 to ComboBox231. Th
comboboxes come from the "Control Toolbox" toolbar.
I have a macro which inserts a row underneath the activecell an
inserts a new combobox on this new row. The code is below.
Problem is that when you select a renamed combobox and look in th
formulabar it shows the correct name, but when you look in th
properties of this combobox the name is still the old name.
Is it possible to also rename the name in the properties of th
combobox?
Thanks in advance for helping me!



Code
-------------------
Sub test()

Set tgt = ActiveCell
Application.ScreenUpdating = False
ActiveCell.Offset(1, 0).EntireRow.Insert
ActiveCell.EntireRow.Copy ActiveCell.Offset(1, 0).EntireRow
Selection.Offset(1, 0).EntireRow.SpecialCells(xlConstants).ClearConten ts
tgt.Select
myrow = ActiveCell.Row
ActiveCell.Offset(1, 0).Select
ActiveSheet.Shapes("ComboBox1").Select
Selection.Copy
ActiveCell.EntireRow.Select
Intersect(Selection, Columns("L:L")).Select
ActiveSheet.Paste
Selection.Name = "ComboBox" & 410
On Error Resume Next
For i = 400 To myrow - 10 Step -1
ActiveSheet.OLEObjects("ComboBox" & i).name = "ComboBox" & i + 1
Next i
myname1 = Sheets(ActiveSheet.Index + 1).Name
LinkedCell = "'" & myname1 & "'!D" & (myrow - 10) * 3
ListFillRange = "'" & myname1 & "'!C" & (myrow - 10) * 3 & ":C" & ((myrow - 10) * 3) + 2
With ActiveSheet.OLEObjects("ComboBox410")
.LinkedCell = LinkedCell
.ListFillRange = ListFillRange
.Name = "ComboBox" & myrow - 10
End With
ActiveCell.Offset(0, -2).Select
End If
Application.ScreenUpdating = True

End Su
-------------------

--
leonida
-----------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...fo&userid=3537
View this thread: http://www.excelforum.com/showthread.php?threadid=56065

 
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
Rename a Worksheet within a Macro AJChrumka Excel Programming 2 April 23rd 06 08:44 PM
rename a workbook using a macro Jamesmsv Excel Programming 1 March 17th 06 02:52 PM
Rename Macro rmpete Excel Discussion (Misc queries) 3 February 11th 06 10:24 PM
rename macro Lois Excel Programming 1 October 13th 04 06:04 PM
Can I rename a directory using a macro Harvey[_3_] Excel Programming 2 February 6th 04 01:49 PM


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