CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Excel Rows ansd columns

    Is there a way to detect the number of IN USE rows and columns in a spreadsheet?

  2. #2
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210
    An EXCEL spreadsheet that is.

  3. #3
    Join Date
    Sep 2002
    Location
    England
    Posts
    530
    Looping through them in the following manner may do it. I'm assuming your wanting some VBA and not wanting to do this from a VB application :-)

    While Not Worksheets(MySheet).Cells(x + i, y + j) = ""

    'put a loop count here

    Wend

  4. #4
    Join Date
    Feb 2002
    Location
    Makati City, Philippines
    Posts
    1,054
    "IN USE"?

    As in being selected/highlighted? The Range.Areas returns the range being selected (including multiple-selection)

    As in -- having a value? -- I think you can use the IsEmpty() function in VBA.
    Marketing our skills - please participate in the survey and share your insights
    -

  5. #5
    Join Date
    Oct 2001
    Location
    India
    Posts
    52
    Set RangeToChek = ActiveCell.CurrentRegion
    RangeToChek.Rows.Count -> will give you the Max Row
    RangeToChek.Columns.Count -> will give you the Max Column

    Please Note that there should not be any Blank Column or A Row in between.

    This works in Macros,

    This should work. I've not tried. You may please verify.

    Good Luck
    Nilapriyan
    ------------------------------------------------
    Learnt is Handful! To Learn is Ocean.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured