{"id":2428,"date":"2026-11-13T15:21:28","date_gmt":"2026-11-13T07:21:28","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=2428"},"modified":"2026-03-29T10:40:09","modified_gmt":"2026-03-29T10:40:09","slug":"how-to-use-rangeshowdependents-in-the-xlwings-api-way","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-use-rangeshowdependents-in-the-xlwings-api-way\/","title":{"rendered":"How to use Range.ShowDependents in the xlwings API way"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The <code>ShowDependents<\/code> member of the <code>Range<\/code> object in Excel&#8217;s object model is a method used to visually highlight cells that depend on the selected range. These dependent cells contain formulas that reference the specified range, meaning their calculated values rely on the data in that range. When invoked, Excel draws tracer arrows from the selected range pointing to all its direct dependents, aiding in auditing and understanding formula relationships within a spreadsheet. This is particularly useful for debugging complex formulas, checking data flow, and ensuring calculation integrity. Note that this method affects the visual display in the Excel interface and does not return a value programmatically; it&#8217;s primarily for user inspection.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In xlwings, the <code>ShowDependents<\/code> method can be accessed through the <code>api<\/code> property of a <code>Range<\/code> object, which provides direct access to the underlying Excel object model. The syntax follows the pattern of the Excel VBA object model but is adapted for Python. The method does not take any parameters. It&#8217;s called directly on a <code>Range<\/code> object to display arrows to its dependents. To remove these arrows later, you would use the <code>ShowPrecedents<\/code> method with a <code>False<\/code> argument or the <code>ClearArrows<\/code> method, but note that <code>ShowDependents<\/code> itself is for display only.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Syntax in xlwings:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>range.api.ShowDependents()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Here, <code>range<\/code> is an xlwings <code>Range<\/code> object (e.g., <code>sheet.range('A1')<\/code>). The <code>.api<\/code> property exposes the native Excel Range object, allowing you to call the <code>ShowDependents<\/code> method. No arguments are required or accepted.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Code Example:<\/strong><br>Consider an Excel workbook where cell B1 contains the formula <code>=A1*2<\/code>, and cell C1 contains <code>=B1+10<\/code>. Both B1 and C1 depend on A1, either directly or indirectly. The following xlwings script selects cell A1 and uses <code>ShowDependents<\/code> to draw arrows to its direct dependents (B1 in this case, as C1 is an indirect dependent of A1).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\n\n# Connect to the active Excel instance and workbook\napp = xw.apps.active\nwb = app.books.active\nsheet = wb.sheets&#91;'Sheet1']\n\n# Define the range (cell A1)\ntarget_range = sheet.range('A1')\n\n# Call ShowDependents to display tracer arrows\ntarget_range.api.ShowDependents()\n\n# To later remove the arrows, you could use:\n# target_range.api.ClearArrows()\n# Or, to remove arrows from dependents specifically (though less common):\n# target_range.api.ShowDependents(False) # Note: False argument works in VBA but may vary in xlwings; ClearArrows is more reliable.<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The `ShowDependents` member of the `Range` object in Excel&apos;s object model is a method used to visual&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-2428","post","type-post","status-publish","format-standard","hentry","category-xlwings-api-reference"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2428","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/comments?post=2428"}],"version-history":[{"count":2,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2428\/revisions"}],"predecessor-version":[{"id":3688,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2428\/revisions\/3688"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=2428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=2428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=2428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}