Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
easy one - select a cell
Hi
I want to be able to select a range eg Application.Goto Reference:="Asset" Once I have done this I want to be able to deduce what the first cell in the range is eg "F1". I want to do this so I can reset the range when people add to it Also is there an easier way to write code to resize the range ie below is recorded but I just want to be able to say =range("F1","F11") etc ActiveWorkbook.Names.Add Name:="Asset", RefersToR1C1:= _ "=Tables!R2C6:R11C6" Thanks -- Kevin |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
easy one - select a cell
activesheet.range("f1:f11").name = "asset"
But you may want to look at using a dynamic range name that can grow and contract... Debra Dalgleish explains it: http://contextures.com/xlNames01.html#Dynamic Kevin wrote: Hi I want to be able to select a range eg Application.Goto Reference:="Asset" Once I have done this I want to be able to deduce what the first cell in the range is eg "F1". I want to do this so I can reset the range when people add to it Also is there an easier way to write code to resize the range ie below is recorded but I just want to be able to say =range("F1","F11") etc ActiveWorkbook.Names.Add Name:="Asset", RefersToR1C1:= _ "=Tables!R2C6:R11C6" Thanks -- Kevin -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
easy one - select a cell
Here is one way to resize a named range that has items added:
Sub test() Dim NewRng As Range Set NewRng = Range("Asset").CurrentRegion ActiveWorkbook.Names.Add Name:="Asset", RefersTo:=NewRng End Sub The CurrentRegion is all non empty cells that are adjacent (contiguous) with named range "Asset" Mike F "Kevin" wrote in message ... Hi I want to be able to select a range eg Application.Goto Reference:="Asset" Once I have done this I want to be able to deduce what the first cell in the range is eg "F1". I want to do this so I can reset the range when people add to it Also is there an easier way to write code to resize the range ie below is recorded but I just want to be able to say =range("F1","F11") etc ActiveWorkbook.Names.Add Name:="Asset", RefersToR1C1:= _ "=Tables!R2C6:R11C6" Thanks -- Kevin |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
easy one - select a cell
just some extra info, select used for illustration:
if you have a range selected, this will select the upper left cell. ActiveCell.CurrentRegion.Cells(1, 1).Select if you want to select the upper left cell in a range using the name: ActiveSheet.Range("Range_Name").Cells(1, 1).Select -- Gary "Kevin" wrote in message ... Hi I want to be able to select a range eg Application.Goto Reference:="Asset" Once I have done this I want to be able to deduce what the first cell in the range is eg "F1". I want to do this so I can reset the range when people add to it Also is there an easier way to write code to resize the range ie below is recorded but I just want to be able to say =range("F1","F11") etc ActiveWorkbook.Names.Add Name:="Asset", RefersToR1C1:= _ "=Tables!R2C6:R11C6" Thanks -- Kevin |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA: Column Select then Data Select then return to cell A1 | Excel Discussion (Misc queries) | |||
Using formulas to select cells (Ex: Select every nth cell in a col | Excel Discussion (Misc queries) | |||
Easy question - If ...then Change cell value | Excel Programming | |||
new user with easy question? not easy for me | New Users to Excel | |||
Easy one: Focus off individual cell? | Excel Programming |