Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
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
  #2  
Old 04-05-2019, 07:33 AM
abenitez77 abenitez77 is offline Last row used Windows 10 Last row used Office 2016
Novice
Last row used
 
Join Date: Apr 2019
Posts: 9
abenitez77 is on a distinguished road
Default

Thanks, I am using this which is what you have but just added "After:=Cells(18000,5)" It is working fine for me:

Code:
RowLast = Columns(5).Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious, After:=Cells(18000, 5)).Row
Reply With Quote
Reply

Thread Tools
Display Modes


Other Forums: Access Forums

All times are GMT -7. The time now is 03:48 AM.


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