Range Class falure

  • Thread starter Thread starter Paul
  • Start date Start date
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
 
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
 
Hi,

you could try the following:

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

or

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

Steven
 
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

.
 
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
 
Back
Top