Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 04-05-2019, 07:05 AM
NoSparks NoSparks is offline Last row used Windows 7 64bit Last row used Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

Perhaps something along the lines of
Code:
Sub testing()

    Dim lastRow As Long, lastColumn As Long, desiredRow As Long
    Dim ws As Worksheet, rRange As Range, myarray2 As Variant

Set ws = ActiveSheet  '<<< alter to suit

lastRow = ws.Cells.SpecialCells(xlCellTypeLastCell).Row
lastColumn = ws.Cells.SpecialCells(xlCellTypeLastCell).Column

desiredRow = Range(Cells(1, 1), Cells(lastRow - 1, lastColumn)).Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row

Set rRange = Range(Cells(1, 1), Cells(desiredRow, lastColumn))
myarray2 = rRange
    
    MsgBox "First dimension (rows)" & vbLf & _
           "   lower bound is   " & LBound(myarray2, 1) & vbLf & _
           "   upper bound is   " & UBound(myarray2, 1) & vbLf & vbLf & _
           "Second dimension (columns)" & vbLf & _
           "   lower bound is   " & LBound(myarray2, 2) & vbLf & _
           "   upper bound is   " & UBound(myarray2, 2)
End Sub
Reply With Quote
 



Other Forums: Access Forums

All times are GMT -7. The time now is 08:55 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft