+ Reply to Thread
Results 1 to 3 of 3

Determine address of cell range and dimension of the cell ranges

Hybrid View

  1. #1
    Registered User
    Join Date
    01-22-2018
    Location
    London
    MS-Off Ver
    2013
    Posts
    2

    Question Determine address of cell range and dimension of the cell ranges

    Good day, programmers

    I'm really new to VBA as I was introduced to it only today. I hope you guys can give me a hand with this. I have different sets of "tables" (not actual table) in sheet 1. The amount of table(s) and amount of data in table will be different from time to time.

    I wonder if we can actually develop a code in which it can determine and record the cell ranges of the table (i.e. Ax:By like A1:B6 or A1:F9) and their dimensions (height and width) in sheet 2?
    Attached Files Attached Files
    Last edited by jamie+; 01-22-2018 at 02:52 AM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Determine address of cell range and dimension of the cell ranges

    If you had gaps between the tables, you could use

    Sub Macro1()
    Dim MyArray
    Dim N As Long
    
    MyArray = Split(Sheets("Sheet1").Cells.SpecialCells(xlCellTypeConstants, 23).Address, ",")
    For N = 0 To UBound(MyArray)
        Sheets("Sheet2").Cells(N + 2, 1) = MyArray(N)
        Sheets("Sheet2").Cells(N + 2, 2) = Range(MyArray(N)).Rows.Count
        Sheets("Sheet2").Cells(N + 2, 3) = Range(MyArray(N)).Columns.Count
    Next N
    End Sub

  3. #3
    Registered User
    Join Date
    01-22-2018
    Location
    London
    MS-Off Ver
    2013
    Posts
    2

    Re: Determine address of cell range and dimension of the cell ranges

    Hi Mrice,

    What if the tables do not have gaps in between? And what if the number of tables will change according to month for example?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Determine the height of selected cell ranges
    By ell_ in forum Excel General
    Replies: 2
    Last Post: 01-17-2018, 09:53 PM
  2. [SOLVED] Use cell value to determine the range
    By ABSTRAKTUS in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-22-2016, 07:22 AM
  3. Determine if range has NO Blank Cells without looping through each cell in range
    By Excelenator in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-04-2006, 01:35 AM
  4. [SOLVED] Determine if a cell is in a range?
    By fedude in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-23-2006, 05:45 PM
  5. VBA - Determine last cell in range?
    By Noozer in forum Excel General
    Replies: 2
    Last Post: 02-24-2006, 05:10 PM
  6. [SOLVED] VBA - Determine last cell in range?
    By Noozer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-24-2006, 05:10 PM
  7. Function to determine if any cell in a range is contained in a given cell
    By choxio@yahoo.com in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-07-2005, 01:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1