Object required Run-time error '424'

A

Ayo

I am getting the above error on the line of code:
Application.ActiveCell.Offset(0, cCol).Text = ctl.Text

and I am not sure what I am doing wrong. Any ideas?
 
G

Gary''s Student

Text is read-only. How about:

Sub qwerty()
Dim stl As Range, cCol As Integer
Set ctl = Range("A1")
cCol = 0
Application.ActiveCell.Offset(0, cCol).Value = ctl.Text
End Sub
 
P

Phil Hibbs

Ayo said:
I am getting the above error on the line of code:
         Application.ActiveCell.Offset(0, cCol).Text = ctl.Text

and I am not sure what I am doing wrong. Any ideas?

What's the value of cCol? One of the functions is returning a null
object. Try breaking it up and see which one fails:

Dim Thing As Object
Set Thing = Application
Set Thing = Application.ActiveCell
Set Thing = Application.ActiveCell.Offset(0, cCol)
Set Thing = Application.ActiveCell.Offset(0, cCol).Text
Set Thing = ctl.Text

Phil Hibbs.
 
J

Jacob Skaria

Try
Application.ActiveCell.Offset(0, cCol) = ctl.Text

If this post helps click Yes
 
A

Ayo

Thanks.

Gary''s Student said:
Text is read-only. How about:

Sub qwerty()
Dim stl As Range, cCol As Integer
Set ctl = Range("A1")
cCol = 0
Application.ActiveCell.Offset(0, cCol).Value = ctl.Text
End Sub
 

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