Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default object error

I am receiving an object error when I run this procedure. I'm not sure why.
It does the calculation. I have posted the procedure that calls the function.

Thanks

Private Sub DivideCells()

Dim value As Double

value = 1000

DivideRange(Range("C15:V15"), value) = Range("C15:V15").value

End Sub


Function DivideRange(myRange As Range, myValue)

Dim myCell As Range

For Each myCell In myRange
myCell.value = myCell / myValue
Next myCell

End Function

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default object error

Hi Monique -

You've probably tried this. Change DivideRange to a PRIVATE SUB accepting
arguements then call DivideRange in your code. It gets you the same result
without the error.

Mike
Sub DivideCells()
Dim value As Double

value = 1000
Call DivideRange(Range("c15:g15"), value)
End Sub


Private Sub DivideRange(myRange As Range, myValue)
Dim myCell As Range

For Each myCell In myRange
myCell.value = myCell / myValue
Next myCell

End Sub

"Monique" wrote:

I am receiving an object error when I run this procedure. I'm not sure why.
It does the calculation. I have posted the procedure that calls the function.

Thanks

Private Sub DivideCells()

Dim value As Double

value = 1000

DivideRange(Range("C15:V15"), value) = Range("C15:V15").value

End Sub


Function DivideRange(myRange As Range, myValue)

Dim myCell As Range

For Each myCell In myRange
myCell.value = myCell / myValue
Next myCell

End Function

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Variable Not Set Error on Selection object Jean Excel Worksheet Functions 3 July 24th 06 06:45 PM
error: ActiveCell.Offset(0, -1).Select = Application-defined or object-defined error -[::::Shamran::::]- Excel Programming 7 June 7th 05 02:14 PM
Macro Run-time Error 1004 Application Defined or Object Defined Error Anddmx Excel Programming 6 June 9th 04 03:40 PM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM
Runtime Error 1004 -- Application Defined or Object Defined Error John[_51_] Excel Programming 3 September 4th 03 04:28 PM


All times are GMT +1. The time now is 10:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"