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

i am trying to create a function that will change the calculation of each
cell in a range. i want to be able to call this function using different
ranges at different times.

Public Function DivideRange(TheRange As Range, c As Range)

Set TheRange = Range("x:y")
For Each c In TheRange
c.Value = c / 1000
Next c

End Function

I am not sure how to get this to work. I have posted what I have created
thus far. Any suggestions would be helpful.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default range function

You cannot change a worksheet from within a function. A function can only
return a value which replaces its call.
You may try a Sub, but you'll have to figure out which event(s) should
trigger it.
Also, you'll have to pass a range as one argument or use a different
construct. But Range("x:y") will not work.

Maybe you can post what you're trying to achieve.

--
Kind regards,

Niek Otten

Microsoft MVP - Excel

"Monique" wrote in message
...
i am trying to create a function that will change the calculation of each
cell in a range. i want to be able to call this function using different
ranges at different times.

Public Function DivideRange(TheRange As Range, c As Range)

Set TheRange = Range("x:y")
For Each c In TheRange
c.Value = c / 1000
Next c

End Function

I am not sure how to get this to work. I have posted what I have created
thus far. Any suggestions would be helpful.

Thanks



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
function range robert Excel Worksheet Functions 1 January 24th 09 12:57 AM
DBSUM function but with function as criterion, not a range corne_mo Excel Worksheet Functions 3 July 13th 07 12:20 PM
range function Felicia Excel Discussion (Misc queries) 2 January 29th 07 06:10 PM
IF function for a value range girth69 Excel Discussion (Misc queries) 6 August 9th 06 03:43 PM
Translate range name passed as string to a custom function to range addresses! agarwaldvk[_25_] Excel Programming 3 September 7th 04 12:47 PM


All times are GMT +1. The time now is 07:20 AM.

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"