Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Error resulting from coding

In a new wb and ws:
In the Immediate Window I enter:
range("A1:A10").Name = "TestRange"
? Range("TestRange").address
$A$1:$A$10 <<< results of above line
Range("TestRange").Resize(5,3) As Range << When I enter this I get

Compile error:

Expected: End of Statement

Why?



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Error resulting from coding

Becuase you are not declaring a variable.

I assume that you want to redefine the name, so try

Range("TestRange").Resize(5,3).Name="TestRange"

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jim May" wrote in message
news:ND%Ad.15517$jn.4876@lakeread06...
In a new wb and ws:
In the Immediate Window I enter:
range("A1:A10").Name = "TestRange"
? Range("TestRange").address
$A$1:$A$10 <<< results of above line
Range("TestRange").Resize(5,3) As Range << When I enter this I get

Compile error:

Expected: End of Statement

Why?





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Error resulting from coding

Ok, while waiting I consulted my Excel 2002 VBA Prog Ref and see
that the following is required, still uncertain why, but
Range("TestRange").Resize(5,3).Name = "TestRange" ' This works!!

"Jim May" wrote in message
news:ND%Ad.15517$jn.4876@lakeread06...
In a new wb and ws:
In the Immediate Window I enter:
range("A1:A10").Name = "TestRange"
? Range("TestRange").address
$A$1:$A$10 <<< results of above line
Range("TestRange").Resize(5,3) As Range << When I enter this I get

Compile error:

Expected: End of Statement

Why?





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Error resulting from coding

As is only used in a declaration/DIM statement.

set rng = Range("TestRange").Resize(5,3)

is possibly what you want.


or perhaps

Range("TestRange").Resize(5,3).Name = "TestRange"

to redefine TestRange
--
Regards,
Tom Ogilvy

"Jim May" wrote in message
news:ND%Ad.15517$jn.4876@lakeread06...
In a new wb and ws:
In the Immediate Window I enter:
range("A1:A10").Name = "TestRange"
? Range("TestRange").address
$A$1:$A$10 <<< results of above line
Range("TestRange").Resize(5,3) As Range << When I enter this I get

Compile error:

Expected: End of Statement

Why?





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Error resulting from coding

an additional (important) lesson for me which I need to know... Question?
Any time one sees the comment:
Expected: End of Statement
....loosely translated - does this mean "you have stopped too soon (with
what's needed)?"
as was the case with me in failing to "tack-on" .name = "TestRange"
Thanks again,
Jim

"Bob Phillips" wrote in message
...
Becuase you are not declaring a variable.

I assume that you want to redefine the name, so try

Range("TestRange").Resize(5,3).Name="TestRange"

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jim May" wrote in message
news:ND%Ad.15517$jn.4876@lakeread06...
In a new wb and ws:
In the Immediate Window I enter:
range("A1:A10").Name = "TestRange"
? Range("TestRange").address
$A$1:$A$10 <<< results of above line
Range("TestRange").Resize(5,3) As Range << When I enter this I get

Compile error:

Expected: End of Statement

Why?









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Error resulting from coding

Tom: Thanks for pointing out
As is only used in a declaration/DIM statement.

Initially I didn't have the "As Range" part.. only
added it thinking that was what was needed..
I failed to remove from my post, but glad now I left it
in as I didn't know the above rule you just gave me; and this rule is good
to know.
Tks,
Jim

"Tom Ogilvy" wrote in message
...
As is only used in a declaration/DIM statement.

set rng = Range("TestRange").Resize(5,3)

is possibly what you want.


or perhaps

Range("TestRange").Resize(5,3).Name = "TestRange"

to redefine TestRange
--
Regards,
Tom Ogilvy

"Jim May" wrote in message
news:ND%Ad.15517$jn.4876@lakeread06...
In a new wb and ws:
In the Immediate Window I enter:
range("A1:A10").Name = "TestRange"
? Range("TestRange").address
$A$1:$A$10 <<< results of above line
Range("TestRange").Resize(5,3) As Range << When I enter this I get

Compile error:

Expected: End of Statement

Why?







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Error resulting from coding

Jim,

What it means is that the parser has come to the end and it hasn't been able
to fully resolve the statement, it expects something else. Often happens
with parentheses, but in this case it needed to be told to do something to
the range defined, but it wasn't happy with what it got.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jim May" wrote in message
news:VM0Bd.15530$jn.310@lakeread06...
an additional (important) lesson for me which I need to know... Question?
Any time one sees the comment:
Expected: End of Statement
...loosely translated - does this mean "you have stopped too soon (with
what's needed)?"
as was the case with me in failing to "tack-on" .name = "TestRange"
Thanks again,
Jim

"Bob Phillips" wrote in message
...
Becuase you are not declaring a variable.

I assume that you want to redefine the name, so try

Range("TestRange").Resize(5,3).Name="TestRange"

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jim May" wrote in message
news:ND%Ad.15517$jn.4876@lakeread06...
In a new wb and ws:
In the Immediate Window I enter:
range("A1:A10").Name = "TestRange"
? Range("TestRange").address
$A$1:$A$10 <<< results of above line
Range("TestRange").Resize(5,3) As Range << When I enter this I get

Compile error:

Expected: End of Statement

Why?









  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Error resulting from coding

Bob:
Thanks for the note. Appreciate you and so many others who give of your
time and experience with Excel. Hope you and yours have a Happy New Year.
Jim May

"Bob Phillips" wrote in message
...
Jim,

What it means is that the parser has come to the end and it hasn't been

able
to fully resolve the statement, it expects something else. Often happens
with parentheses, but in this case it needed to be told to do something to
the range defined, but it wasn't happy with what it got.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jim May" wrote in message
news:VM0Bd.15530$jn.310@lakeread06...
an additional (important) lesson for me which I need to know...

Question?
Any time one sees the comment:
Expected: End of Statement
...loosely translated - does this mean "you have stopped too soon (with
what's needed)?"
as was the case with me in failing to "tack-on" .name = "TestRange"
Thanks again,
Jim

"Bob Phillips" wrote in message
...
Becuase you are not declaring a variable.

I assume that you want to redefine the name, so try

Range("TestRange").Resize(5,3).Name="TestRange"

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jim May" wrote in message
news:ND%Ad.15517$jn.4876@lakeread06...
In a new wb and ws:
In the Immediate Window I enter:
range("A1:A10").Name = "TestRange"
? Range("TestRange").address
$A$1:$A$10 <<< results of above line
Range("TestRange").Resize(5,3) As Range << When I enter this I

get

Compile error:

Expected: End of Statement

Why?











  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Error resulting from coding

Thanks Jim, really appreciate such kind comments. All the best to you and
your family for the New Year, and to all of our Excel colleagues.

Bob


"Jim May" wrote in message
news:NxhBd.16025$jn.8922@lakeread06...
Bob:
Thanks for the note. Appreciate you and so many others who give of your
time and experience with Excel. Hope you and yours have a Happy New Year.
Jim May

"Bob Phillips" wrote in message
...
Jim,

What it means is that the parser has come to the end and it hasn't been

able
to fully resolve the statement, it expects something else. Often happens
with parentheses, but in this case it needed to be told to do something

to
the range defined, but it wasn't happy with what it got.

--

HTH

RP
(remove nothere from the email address if mailing direct)



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
If-Then-Else resulting in DIV/0 error scapen Excel Programming 2 October 10th 04 01:14 AM
If-Then-Else resulting in DIV/0 error scapen[_6_] Excel Programming 1 October 10th 04 01:00 AM
If-Then-Else resulting in DIV/0 error scapen[_5_] Excel Programming 1 October 10th 04 12:51 AM
If-Then-Else resulting in DIV/0 error scapen[_4_] Excel Programming 1 October 10th 04 12:22 AM
If-Then-Else resulting in DIV/0 error scapen[_3_] Excel Programming 1 October 9th 04 11:25 PM


All times are GMT +1. The time now is 09:04 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"