Run-time error 424, Object required

P

perldev

I have the following code:

sub foo()
dim record as range
set record = Range("A" & ActiveCell.row & ":K" & ActiveCell.row)

record.select
Upload(record)
end sub

public sub Upload(ByRef r as Range)
.....
end sub

It keeps throwing out error: "run-time error 424, Object required",
what's wrong?

debug.print record.Address(external:=true) shows:
[Junk.xls]Sheet1!$A$6:$K$6
 
B

Bob Phillips

Sub foo()
Dim record As Range
Set record = Range("A" & ActiveCell.Row & ":K" & ActiveCell.Row)

record.Select
upload record
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
P

perldev

The foo sub threw out the error.

Sub foo()
..
On Error GoTo ErrorHandle
Upload(record)
exit sub
ErrorHandle:
Msgbox "Something wrong with range", vbCritical
End Sub

It hit the msgbox.

Bob said:
Sub foo()
Dim record As Range
Set record = Range("A" & ActiveCell.Row & ":K" & ActiveCell.Row)

record.Select
upload record
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

I have the following code:

sub foo()
dim record as range
set record = Range("A" & ActiveCell.row & ":K" & ActiveCell.row)

record.select
Upload(record)
end sub

public sub Upload(ByRef r as Range)
....
end sub

It keeps throwing out error: "run-time error 424, Object required",
what's wrong?

debug.print record.Address(external:=true) shows:
[Junk.xls]Sheet1!$A$6:$K$6
 
D

Dave Peterson

Bob's suggestion was to remove the () in:
Upload(record)
change this line to:
Upload record

You could also use:
Call Upload(record)




The foo sub threw out the error.

Sub foo()
..
On Error GoTo ErrorHandle
Upload(record)
exit sub
ErrorHandle:
Msgbox "Something wrong with range", vbCritical
End Sub

It hit the msgbox.

Bob said:
Sub foo()
Dim record As Range
Set record = Range("A" & ActiveCell.Row & ":K" & ActiveCell.Row)

record.Select
upload record
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

I have the following code:

sub foo()
dim record as range
set record = Range("A" & ActiveCell.row & ":K" & ActiveCell.row)

record.select
Upload(record)
end sub

public sub Upload(ByRef r as Range)
....
end sub

It keeps throwing out error: "run-time error 424, Object required",
what's wrong?

debug.print record.Address(external:=true) shows:
[Junk.xls]Sheet1!$A$6:$K$6
 
P

perldev

This worked! Thank you Dave!

Dave said:
Bob's suggestion was to remove the () in:
Upload(record)
change this line to:
Upload record

You could also use:
Call Upload(record)




The foo sub threw out the error.

Sub foo()
..
On Error GoTo ErrorHandle
Upload(record)
exit sub
ErrorHandle:
Msgbox "Something wrong with range", vbCritical
End Sub

It hit the msgbox.

Bob said:
Sub foo()
Dim record As Range
Set record = Range("A" & ActiveCell.Row & ":K" & ActiveCell.Row)

record.Select
upload record
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

I have the following code:

sub foo()
dim record as range
set record = Range("A" & ActiveCell.row & ":K" & ActiveCell.row)

record.select
Upload(record)
end sub

public sub Upload(ByRef r as Range)
....
end sub

It keeps throwing out error: "run-time error 424, Object required",
what's wrong?

debug.print record.Address(external:=true) shows:
[Junk.xls]Sheet1!$A$6:$K$6
 
D

Dave Peterson

That was Bob's suggestion--but I'm sure he's happy you got it working.

This worked! Thank you Dave!

Dave said:
Bob's suggestion was to remove the () in:
Upload(record)
change this line to:
Upload record

You could also use:
Call Upload(record)




The foo sub threw out the error.

Sub foo()
..
On Error GoTo ErrorHandle
Upload(record)
exit sub
ErrorHandle:
Msgbox "Something wrong with range", vbCritical
End Sub

It hit the msgbox.

Bob Phillips wrote:
Sub foo()
Dim record As Range
Set record = Range("A" & ActiveCell.Row & ":K" & ActiveCell.Row)

record.Select
upload record
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

I have the following code:

sub foo()
dim record as range
set record = Range("A" & ActiveCell.row & ":K" & ActiveCell.row)

record.select
Upload(record)
end sub

public sub Upload(ByRef r as Range)
....
end sub

It keeps throwing out error: "run-time error 424, Object required",
what's wrong?

debug.print record.Address(external:=true) shows:
[Junk.xls]Sheet1!$A$6:$K$6
 

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