-
Insert forms: Size to user defined range
I'm trying to develop a macro where a user selects a form (like a Check Box or Combo Box) and defines the cell address where that form will be inserted into a worksheet (by using something like refedit).
Getting the form info and the refedit info is relatively easy, but does anyone know how I can tell excel that the form must be placed exactly within the cell range defined in the refedit?
Cheers,
Milken
-
Here is an example with a RefEdit control on a User Form.
[vba]
Option Explicit
Private Sub CommandButton1_Click()
Dim Rng As Range
Set Rng = Range(Me.RefEdit1.Value)
Sheet1.OLEObjects.Add "Forms.Checkbox.1", _
Left:=Rng.Left, Top:=Rng.Top, Height:=Rng.Height, Width:=Rng.Width
End Sub
[/vba]
You can then add a Select Case to determine what control to add (based on user input).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules