Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just to be neat about it.
Sub gj() Dim Rng As String, Rng1 As String, myRange As Range Rng = ActiveSheet.UsedRange.Address Rng1 = Right(Rng, Len(Rng) - InStr(Rng, ":")) Set myRange = Range("B8:" & Rng1) MsgBox myRange.Address End Sub In case you use Option Explicit. "James" wrote: Thanks for the link, Tim. I tried this but cant seem to refrence it in my code. i did a simple MsgBox MyRange.Address and it says 'object required' The proper range is being selected when I do Insert-Name-Range. Is there a special way to refrence it in the code. Couldnt find it on the page you gave me. thx JLGWhiz, I tried your version and it would work great but it selects Range("A1:T373"), I want it to select only Range("B8:T373"). Could I do something like Set Rng = ActiveCell.CurrentRegion Set MyRange=Rng.Offset(8,1).Resize(Rng.Rows.Count-8,Rng.Columns.Count-1) MsgBox MyRange.Address when i try this i get a "1004 application or object defined error" ================================================== === "Tim" wrote: you could try a 'dynamic named range' and refer to that in your code/worksheet: - http://www.ozgrid.com/Excel/DynamicRanges.htm you just need to be careful about which rows/columns you choose to base the range on (ie, they have to be ones that will always have an entry, otherwise the 'shape' of the range will be wrong). hth, Tim "James" wrote in message ... Hi everyone, Maybe a quick question. How do I create a range that knows exactly how big the data range is? I Want the range to start at "B8" and go to Last used row, and last used column. Is this possible? Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Changing the range for averages with out changing the formula. | Excel Worksheet Functions | |||
Autofill 1 column with changing data and changing range | Excel Programming | |||
Incrementing no.s creating new but not changing no. opening saved | Excel Discussion (Misc queries) | |||
Creating an changing scale on x axis for outlying cases | Charts and Charting in Excel | |||
Changing the comma for a semicolon when creating a CSV file | Excel Programming |