Skip to main content

Range.SetCellDataTypeFromCell method

Table of contents
  1. Syntax
  2. Parameters
  3. Example

Creates another instance of a Linked data type, such as Stocks or Geography, that exists in another cell. The new instance will be linked to the data source in the same way as the original, so it will refresh from the service if you call the Workbook.RefreshAll method.


expression.SetCellDataTypeFromCell (Range, LanguageCulture)

expression A variable that represents the Range object to which you want to copy the Linked data type.


Name Required/Optional Data type Description
Range Required Range The range from which you want to copy the Linked data type. If the range has more than one cell in it, only the upper-left cell will be used.
LanguageCulture Required String A string representing the LCID of the language and culture that you would like to use for the linked entity.


If you have a Geography Linked data type in cell A1 for the city Seattle, this code copies the Seattle entity to cell B2.

Range("B2").SetCellDataTypeFromCell Range("A1")

After it runs, cells A1 and B2 will contain a Seattle data type, and they will both refresh if you call the RefreshAll method. No other cell properties, such as formats, will be copied from A1 to B2.

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>