Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Case Range(4, 2).value 3

Status
Not open for further replies.

WaterSprite

Technical User
Mar 23, 2004
69
US
How come this code will not work,
Select Case Range(4, 2).Value
Case Is = February

I get runtime error 1004, range of object_Global failed.

But this code will:

Select Case Range("B4").Value
Case Is = February

Entering B4 is of no consequence, I just thought the (4, 2) would speed up the process.
 
Range doesn't recognize (4,2). But Cells will.

Select Case Cells(4, 2).Value
Case Is = February

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 

hi,

You need QUOTES...
Code:
Select Case Cells(4, 2).Value
Case Is = [red][b]"[/b][/red]February[red][b]"[/b][/red]

Skip,

[glasses] [red][/red]
[tongue]
 
Range is a parent object of cells

Range requires a string entry like A1

Cells requires 2 integer entries to tell it the row & column

to use the cells type reference in the range object, your syntax should be:

Range(cells(4,2),cells(4,2)).value

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Thanks. I thought I had tried every code combination possible before I gave up and asked for help. The folks on this forum are the greatest.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top