Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Determine range with VBA

I am looking to copy Data from another Workbook (which is
never the same size). what code do I need to determine
the last row that data is entered on so I can set up the
Range?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Determine range with VBA

Dim rng as Range
with Workbooks("OtherName.xls").Worksheets("Sheet1")
set rng = .Range(.Cells(1,1),.Cells(rows.count,1).End(xlup))
set rng = rng.Resize(,10) ' to get 10 columns
End with

or

set rng = .Range("A1").CurrentRegion

or
' less reliable
set rng = .UsedRange

--
Regards,
Tom Ogilvy

Bryon wrote in message
...
I am looking to copy Data from another Workbook (which is
never the same size). what code do I need to determine
the last row that data is entered on so I can set up the
Range?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
determine a range using a formula Jonathon Shull Excel Worksheet Functions 2 April 30th 10 05:23 PM
use active cell to determine range Gizmo Excel Discussion (Misc queries) 2 March 31st 08 04:55 AM
Determine if a value in a range is close to the value of another c Raven Excel Worksheet Functions 0 June 7th 06 07:47 PM
Determine if a value in a range is close to the value of another c Marcelo Excel Worksheet Functions 0 June 7th 06 07:46 PM
Determine whether a value is in a range of cells Carl Excel Discussion (Misc queries) 2 December 12th 05 12:23 AM


All times are GMT +1. The time now is 05:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"