View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Repost of listbox losing linked cell

I don't understand what this means.

Dkline wrote:

Thanks for the reply. Now the problem is the function doesn't work. This
isn't a coding problem anymore.

"Dave Peterson" wrote:

I'd use that same syntax as you used in the .listfillrange

..LinkedCell = ws.Range("AK5").Address(external:=True)

Just in case Inputs wasn't the activesheet.


Dkline wrote:

I apologize if this is a duplicate of a message from an hour ago. Ithas not
been posted yet and I am desperate.

I have a listbox with a linked cell of AK5. The listbox is not in a
userform. It is taken from the Control Toobox bar and placed on the worksheet
itself.

I have named it lbFinCarrier. In the Formula box it shows
"=EMBED("Forms.ListBox.1","")"

For some reason, it loses its connection to the linked cell AK5. I can
scroll through the listbox and the value in the lnked cell does not change.

Sub FillListBoxCarriers()
Dim wb As Workbook
Dim ws As Worksheet
Dim strListRange As String
Dim OLEObj As OLEObject

Set wb = ThisWorkbook
Set ws = wb.Worksheets("Inputs")
ws.Select
strListRange = "AK6:AK39"

Set OLEObj = ws.OLEObjects("lbFinCarrier")
With OLEObj
.LinkedCell = ws.Range("AK5")
.ListFillRange =
ActiveSheet.Range(strListRange).Address(external:= True)
End With

Set OLEObj = Nothing
Set ws = Nothing
Set wb = Nothing
End Sub


--

Dave Peterson


--

Dave Peterson