Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7646979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:20:57+00:00 2026-05-31T10:20:57+00:00

In Excel’s COM API: Given an ExcelRange object, how would I determine which rows

  • 0

In Excel’s COM API:

Given an ExcelRange object, how would I determine which rows and columns are contained within it?

I do not want the contents of the range, just the “coordinates” of the range, preferably as integers.

I did notice that ExcelRange has both a Row and a Column property, however these only indicate the row and column of the upper left corner of the range.

Note: I am using Delphi, however this question could be relevant to any language using Excel though COM, so answering using Delphi is not necessary.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T10:20:58+00:00Added an answer on May 31, 2026 at 10:20 am

    Assuming a simple rectangular range then you use the Rows and Columns properties of the ExcelRange object. The top-left of the selection is determined by Range.Row and Range.Column. The number of selected rows and columns is given by Range.Rows.Count and Range.Columns.Count.

    In complete generality an Excel range can be made up of multiple non-contiguous areas. In this case you use the Areas property of ExcelRange to iterate through the simple rectangular ranges that make up the complex range.

    To illustrate consider the following code:

    procedure DescribeExcelRange(const Range: ExcelRange);
    var
      AreaIndex: Integer;
      Area: ExcelRange;
    begin
      for AreaIndex := 1 to Range.Areas.Count do
      begin
        Area := Range.Areas[i];
        Writeln(Format(
          'Area %d: R%dC%d:R%dC%d',
          [AreaIndex, Area.Row, Area.Column, 
           Area.Row+Area.Rows.Count-1, Area.Column+Area.Columns.Count-1]
        ));
      end;
    end;
    

    I have not actually tested this code so I hope I have remembered correctly that indexing is 1-based.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Excel, let's say I have 5 columns, but not all of the time
Excel 2007: I have an app which outputs several rows, with pipe delimiters, into
Microsoft Excel 2000 does not import csv encoded in UTF-8 properly. Which encoding should
My excel sheet contains many columns and many rows. I want the program to
In Excel Formulas there are so many different functions, that I am not sure
The Excel 2003 API has a GetSaveAsFilename method that pops up the Save As
Excel macros do not seem to allow the use of undo after running them.
An excel question (probably not the best place to ask) I have an MS
in Excel, =ROUNDUP(474.872126666666, 2) -> 474.88 in .NET, Math.Round(474.87212666666666666666666666667, 2, MidpointRounding.ToEven) // 474.87 Math.Round(474.87212666666666666666666666667,
When Excel determines the axis values it will use to represent your data in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.