T
TheMath
I have a macro that assigns the Cell link value for the Drop Down (from Form
Tools, not ActiveX). It merely sets the Drop Down's LinkedCell to the cell
that is under the TopLeft corner of the Drop Down control.
This causes the Index (Integer) of the selected item to be placed in the
LinkedCell. I must find the contents of the cell that is referenced by this
number as an offset into the Input Range of cells that are specified for this
Drop Down control. I must copy that string from the source range to another
cell, but I don't know the VBA code to accomplish this. The part of this
code that assigns the LinkedCell works, but the line after that (the Set
SourceRange) fails with:
Run-time error '438':
Object doesn't support this property or method
Dim SourceData As Range
Dim Val as String
For Each bx In ActiveSheet.DropDowns
bx.LinkedCell = bx.TopLeftCell.Address(external:=True)
' 2 lines of psuedo-code below. What's the real syntax?
Set SourceData = Range(bx.RowSource)
Val = SourceData.Offset(bx.LinkedCell)
Next
Question 1) What is the real VBA code needed to return the contents of the
cell referenced by the Index value that is now stored in the LinkedCell?
Question 2) Where does one find the documentation for the methods and
properties of these controls from the Form Tools menu. I see all sorts of
help that deal with creating drop downs, but little about VBA reference to
their methods and properties.
Tools, not ActiveX). It merely sets the Drop Down's LinkedCell to the cell
that is under the TopLeft corner of the Drop Down control.
This causes the Index (Integer) of the selected item to be placed in the
LinkedCell. I must find the contents of the cell that is referenced by this
number as an offset into the Input Range of cells that are specified for this
Drop Down control. I must copy that string from the source range to another
cell, but I don't know the VBA code to accomplish this. The part of this
code that assigns the LinkedCell works, but the line after that (the Set
SourceRange) fails with:
Run-time error '438':
Object doesn't support this property or method
Dim SourceData As Range
Dim Val as String
For Each bx In ActiveSheet.DropDowns
bx.LinkedCell = bx.TopLeftCell.Address(external:=True)
' 2 lines of psuedo-code below. What's the real syntax?
Set SourceData = Range(bx.RowSource)
Val = SourceData.Offset(bx.LinkedCell)
Next
Question 1) What is the real VBA code needed to return the contents of the
cell referenced by the Index value that is now stored in the LinkedCell?
Question 2) Where does one find the documentation for the methods and
properties of these controls from the Form Tools menu. I see all sorts of
help that deal with creating drop downs, but little about VBA reference to
their methods and properties.