Range Class falure

P

Paul

Hi,
Why it does't work and returns "range class falure"

i = "o5"
Worksheets(mahlaka).Activate
Range(i).Select
ActiveCell.Offset(0, 1).Select
i = ActiveCell.Address

Please help me
 
P

Patrick Molloy

try something like this:

Sub abc()
Dim add As String
Dim mahlaka As String
mahlaka = "sheet1"
add = "o5"
MsgBox _
Worksheets(mahlaka).Range(add).Offset(0, 1).Address

End Sub


Patrick Molloy
Microsoft Excel MVP
 
G

Guest

Hi,

you could try the following:

Worksheets("mahlaka").range("05").select

or

i= worksheets("mahlaka").range(i).offset(0,1).address

Steven
 
P

Paul

Thank YOU !!!!!!!!!!!!!!!


-----Original Message-----
try something like this:

Sub abc()
Dim add As String
Dim mahlaka As String
mahlaka = "sheet1"
add = "o5"
MsgBox _
Worksheets(mahlaka).Range(add).Offset(0, 1).Address

End Sub


Patrick Molloy
Microsoft Excel MVP

.
 
L

libby

Hi
I think you're getting the range class failure because you
haven't specified what sheet Range(i) is on and you
haven't put the name of the worksheet in quotes.

Try

Dim i
i = "o5"
Worksheets("mahlaka").Activate
ActiveSheet.Range(i).Select
ActiveCell.Offset(0, 1).Select
i = ActiveCell.Address

Also you could lose a line of code and use the following

dim i
i = "o5"
Worksheets("mahlaka").Activate
ActiveSheet.Range(i).Offset(0, 1).Select
i = ActiveCell.Address

Hope this helps
Libby
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top