Results 1 to 5 of 5

Linked Cell for ActiveX Checkbox via VBA

Threaded View

  1. #1
    Registered User
    Join Date
    03-30-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    7

    Linked Cell for ActiveX Checkbox via VBA

    I am trying to insert an ActiveX Checkbox into a worksheet. Have finally figured out many things on how to do this, however am stumped on getting the “Linked Cell” to work without a “Run-time error ‘438’: Object doesn’t support this property or method” The code between the asterisks:
    “.LinkedCell = LC.Address”

    seems to cause the error. I have tried many other versions from websites all over:


    '.LinkedCell = Cells(r + 1, 26).Address
    '.Placement = xlMove
    '.LinkedCell = LC.Offset(0, -8).Address
    '.LinkedCell = LC.Address
    '.LinkedCell = .TopLeftCell.Offset(0, lCol).Address
    '.LinkedCell = Cells(r + 1, 26).Address
    '.LinkedCell = ActiveSheet.Range("Z" & (r + 1))

    None seem to work.
    I would appreciate any help anyone could give me. Would also like to change the name to "Checkbox_" & (r+1), if that is possible, however I get a similar error if I try to use .Name:="Checkbox_" & (r+1)

    Current Code is:

    Sub Add_Checkbox()
    
    'Works, except to get the linked Cell
    
    Dim oleObj As OLEObject
    
    Dim sh As Worksheet
    Dim o As OLEObject
    Dim r As Integer
    Dim LC As Range
    
    Set LC = Cells(r + 1, 26)
    r = 21
    
    Set oleObj = ActiveSheet.OLEObjects.Add(ClassType:="Forms.CheckBox.1", _
    link:=False, _
    DisplayAsIcon:=False, _
    Left:=Range("AH" & (r + 1)).Left + Range("AI" & (r + 1)).Width, _
    Top:=Range("AH" & (r + 1)).Top + 1, Width:=Range("AH" & (r + 1)).Width - 1, _
    Height:=Range("AI" & (r + 1)).Height - 1.5)
    
    
    With oleObj.Object
        .Caption = "Equipment?"
        .Font.Size = 6
        .BackColor = &H80FF80
    '*****************************
        .LinkedCell = LC.Address
    '*****************************
    End With
    End Sub
    Thanks in advance,

    Papa Newch
    Last edited by Papa Newch; 11-05-2014 at 05:05 PM. Reason: Added Code Tags - Sorry about the rookie mistake

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Lock cell linked to checkbox when checkbox is ticked
    By simeony003 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-30-2013, 10:08 AM
  2. Using ActiveX CheckBox Control to make a cell change colour and clear values
    By drmit in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-20-2012, 04:18 AM
  3. [SOLVED] ComboBox Activex Linked Cell displaying numbers
    By Bishonen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2012, 12:31 PM
  4. [SOLVED] Can I control linked cell property value in a copied ActiveX contr
    By Beechbeard in forum Excel General
    Replies: 0
    Last Post: 05-04-2005, 06:06 PM
  5. [SOLVED] Linked Cell Property In Activex controls
    By KG in forum Excel General
    Replies: 4
    Last Post: 02-26-2005, 07:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1