Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How a function can modify a value from some cells ?
I have a module with a function where I receive a range of cells. Every time
I try to modify the value of this cells I receive an error "out of context". There are some way to do it ? Best regards Cristian |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How a function can modify a value from some cells ?
Cristian wrote: I have a module with a function where I receive a range of cells. Every time I try to modify the value of this cells I receive an error "out of context". There are some way to do it ? Best regards Cristian You need to post the code here so one of the experts (not me) can see exactly what the problem is. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How a function can modify a value from some cells ?
Post your code... Also note that A UDF called from a worksheet can not modify
any cell other than the one it is called from... Called from code it can change whatever it wants, but not if called from a sheet. -- HTH... Jim Thomlinson "Cristian" wrote: I have a module with a function where I receive a range of cells. Every time I try to modify the value of this cells I receive an error "out of context". There are some way to do it ? Best regards Cristian |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How a function can modify a value from some cells ?
The code:
Function Teste(Cells As Object) For Each cell In Cells cell.Value = 11 Next end function "Jim Thomlinson" wrote: Post your code... Also note that A UDF called from a worksheet can not modify any cell other than the one it is called from... Called from code it can change whatever it wants, but not if called from a sheet. -- HTH... Jim Thomlinson "Cristian" wrote: I have a module with a function where I receive a range of cells. Every time I try to modify the value of this cells I receive an error "out of context". There are some way to do it ? Best regards Cristian |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How a function can modify a value from some cells ?
Cells is a reserved word. Try changing it it something like rngCells or
rCells... -- HTH... Jim Thomlinson "Cristian" wrote: The code: Function Teste(Cells As Object) For Each cell In Cells cell.Value = 11 Next end function "Jim Thomlinson" wrote: Post your code... Also note that A UDF called from a worksheet can not modify any cell other than the one it is called from... Called from code it can change whatever it wants, but not if called from a sheet. -- HTH... Jim Thomlinson "Cristian" wrote: I have a module with a function where I receive a range of cells. Every time I try to modify the value of this cells I receive an error "out of context". There are some way to do it ? Best regards Cristian |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
How a function can modify a value from some cells ?
Cristian,
Function Teste() Teste = 11 End Function Enter =Teste() into every cell in your range Cells. OR: run the macro test() Sub test() Teste Range("A1:A10") End Sub Function Teste(myCells As Object) For Each mycell In myCells mycell.Value = 11 Next End Function HTH, Bernie MS Excel MVP "Cristian" wrote in message ... The code: Function Teste(Cells As Object) For Each cell In Cells cell.Value = 11 Next end function "Jim Thomlinson" wrote: Post your code... Also note that A UDF called from a worksheet can not modify any cell other than the one it is called from... Called from code it can change whatever it wants, but not if called from a sheet. -- HTH... Jim Thomlinson "Cristian" wrote: I have a module with a function where I receive a range of cells. Every time I try to modify the value of this cells I receive an error "out of context". There are some way to do it ? Best regards Cristian |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Modify search function | Excel Worksheet Functions | |||
How do I modify the autofit function in Excel? | Excel Discussion (Misc queries) | |||
Can I modify a Hyperlink with a function? | Excel Discussion (Misc queries) | |||
Modify cell from function | Excel Programming | |||
to modify cells from a function | Excel Programming |