Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trouble getting used to VBA
I am new to Visual basic and have made only a few
applications i was wondering if someone knew how to name a range as a variable. The bottom part is where im having the issue Thanks Jeff Dim INS As Range ActiveCell.Offset(0, 2).Select Range(Selection, Selection.End(xlDown)).Select ' Trying to name the following range INS = activeRange.Select End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trouble getting used to VBA
If you want to create an Excel name for a range (the same as Define Name):
Range(Selection, Selection.End(xlDown)).Name = "MyName" If you want to create a range object variable for a range in VB: Set INS = Range(Selection, Selection.End(xlDown)) -- Jim Rech Excel MVP "JF" wrote in message ... |I am new to Visual basic and have made only a few | applications i was wondering if someone knew how to name a | range as a variable. The bottom part is where im having | the issue | | | Thanks | | Jeff | | Dim INS As Range | | ActiveCell.Offset(0, 2).Select | Range(Selection, Selection.End(xlDown)).Select | | ' Trying to name the following range | INS = activeRange.Select | | End Sub | | |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trouble getting used to VBA
JF wrote:
I am new to Visual basic and have made only a few applications i was wondering if someone knew how to name a range as a variable. The bottom part is where im having the issue Thanks Jeff Dim INS As Range ActiveCell.Offset(0, 2).Select Range(Selection, Selection.End(xlDown)).Select ' Trying to name the following range INS = activeRange.Select End Sub The following macro (Sub procedure) will assign the designated range to the variable "INS": Sub BBB() Dim rngTemp As Range, INS As Range Set rngTemp = ActiveCell(1, 3) '<---This is equivalent to 'Set rngTemp = ActiveCell.Offset(0, 2) Set INS = Range(rngTemp, rngTemp.End(xlDown)) End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Trouble. | Charts and Charting in Excel | |||
Still having trouble | Excel Discussion (Misc queries) | |||
>= Trouble | Excel Discussion (Misc queries) | |||
still having trouble with this.... | Excel Worksheet Functions | |||
trouble with add ins | Excel Discussion (Misc queries) |