Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default What data type for Variable?

What would be the correct data type if I wanted to declare
and set the variable below?

dim StartPoint as ???
dim myRange as ???

Set StartPoint = Range("A1").Select
Set myRange = ActiveCell.Offset(rowindex:=0,
columnindex:=0).select
I know I can always use 'As Variant' but this uses the
most memory. Is there something else I should be using?

Jeff
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default What data type for Variable?

Hi
dim StartPoint as range
dim myRange as range

Set StartPoint = Range("A1")
Set myRange = ActiveCell


--
Regards
Frank Kabel
Frankfurt, Germany


Jeff Armstrong wrote:
What would be the correct data type if I wanted to declare
and set the variable below?

dim StartPoint as ???
dim myRange as ???

Set StartPoint = Range("A1").Select
Set myRange = ActiveCell.Offset(rowindex:=0,
columnindex:=0).select
I know I can always use 'As Variant' but this uses the
most memory. Is there something else I should be using?

Jeff

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default What data type for Variable?

Ok, here's the problem. I have another variable that I
declared as:

Dim StartRange As Range

I want to store a cells address to this variable. In the
past I delcared the variable as a variant type and then
used the line of code:

StartRange = ActiveCell.Address

I am trying to optimize my code. Now when I try to do it
with the Range type I get the following error:

Object variable or With block variable not set

How do I need to declare the variable and then store a
particular cell address to that variable?


-----Original Message-----
Hi
dim StartPoint as range
dim myRange as range

Set StartPoint = Range("A1")
Set myRange = ActiveCell


--
Regards
Frank Kabel
Frankfurt, Germany


Jeff Armstrong wrote:
What would be the correct data type if I wanted to

declare
and set the variable below?

dim StartPoint as ???
dim myRange as ???

Set StartPoint = Range("A1").Select
Set myRange = ActiveCell.Offset(rowindex:=0,
columnindex:=0).select
I know I can always use 'As Variant' but this uses the
most memory. Is there something else I should be using?

Jeff

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default What data type for Variable?

a cell address is a string, a reference to the cell is a range

------- using range reference --------
Dim rng as range

set rng = ActiveCell

Usage:
rng.Value = 6

------ using address property ------

Dim sAddr as String
sAddr = ActiveCell.Address

Usage:
Range(sAddr).Value = 6

--
Regards,
Tom Ogilvy

"Jeff Armstrong" wrote in message
...
Ok, here's the problem. I have another variable that I
declared as:

Dim StartRange As Range

I want to store a cells address to this variable. In the
past I delcared the variable as a variant type and then
used the line of code:

StartRange = ActiveCell.Address

I am trying to optimize my code. Now when I try to do it
with the Range type I get the following error:

Object variable or With block variable not set

How do I need to declare the variable and then store a
particular cell address to that variable?


-----Original Message-----
Hi
dim StartPoint as range
dim myRange as range

Set StartPoint = Range("A1")
Set myRange = ActiveCell


--
Regards
Frank Kabel
Frankfurt, Germany


Jeff Armstrong wrote:
What would be the correct data type if I wanted to

declare
and set the variable below?

dim StartPoint as ???
dim myRange as ???

Set StartPoint = Range("A1").Select
Set myRange = ActiveCell.Offset(rowindex:=0,
columnindex:=0).select
I know I can always use 'As Variant' but this uses the
most memory. Is there something else I should be using?

Jeff

.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default What data type for Variable?

Dim StartRange As Range
Set StartRange = ActiveCell
MsgBox StartRange.Address

HTH. Best wishes Harald

"Jeff Armstrong" skrev i melding
...
Ok, here's the problem. I have another variable that I
declared as:

Dim StartRange As Range

I want to store a cells address to this variable. In the
past I delcared the variable as a variant type and then
used the line of code:

StartRange = ActiveCell.Address

I am trying to optimize my code. Now when I try to do it
with the Range type I get the following error:

Object variable or With block variable not set

How do I need to declare the variable and then store a
particular cell address to that variable?


-----Original Message-----
Hi
dim StartPoint as range
dim myRange as range

Set StartPoint = Range("A1")
Set myRange = ActiveCell


--
Regards
Frank Kabel
Frankfurt, Germany


Jeff Armstrong wrote:
What would be the correct data type if I wanted to

declare
and set the variable below?

dim StartPoint as ???
dim myRange as ???

Set StartPoint = Range("A1").Select
Set myRange = ActiveCell.Offset(rowindex:=0,
columnindex:=0).select
I know I can always use 'As Variant' but this uses the
most memory. Is there something else I should be using?

Jeff

.



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
Range type variable oddness Nick Excel Programming 7 July 26th 04 09:42 AM
Trouble with variable type Ken McLennan[_3_] Excel Programming 2 June 2nd 04 08:04 AM
efine the data type of a variable monika Excel Programming 0 February 13th 04 02:01 AM
type variable as argument of a sub Koos Excel Programming 1 October 23rd 03 11:41 AM
Variable Type - help me to solve this choco140 Excel Programming 1 September 28th 03 10:39 AM


All times are GMT +1. The time now is 03:37 AM.

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"