Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I get the error #VALUE! as a result of the following VB code Cells(2, 2) =
Cells(2, 25). according to the examples and the books this should work and is very easy, but i can not make it work, the cell types are both GENERAL and the contents are strings. i have tried string to string and using ranges and everything else that i can find and nothing allows me to move the contents of one cell to another. it has to be a simple answer. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Give this a try.
Range("B2").value = Range("B25").Value Devin "Bob Taylor" wrote: I get the error #VALUE! as a result of the following VB code Cells(2, 2) = Cells(2, 25). according to the examples and the books this should work and is very easy, but i can not make it work, the cell types are both GENERAL and the contents are strings. i have tried string to string and using ranges and everything else that i can find and nothing allows me to move the contents of one cell to another. it has to be a simple answer. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Devin
thanks for the info.. i had tried this and it failed. i recode it as Function MV() On Error GoTo bob Range("B3").ClearContents Range("B3").Value = Range("Y3").Value 'Cells(2, 2) = Cells(2, 25) bob: ' MsgBox " cannot store in old values" End Function it fails again. when i run with a stop on, and watch the cells it fails on first pass. however if i step into it again it works. i don't understand what is going on. bob "DMoney" wrote in message ... Give this a try. Range("B2").value = Range("B25").Value Devin "Bob Taylor" wrote: I get the error #VALUE! as a result of the following VB code Cells(2, 2) = Cells(2, 25). according to the examples and the books this should work and is very easy, but i can not make it work, the cell types are both GENERAL and the contents are strings. i have tried string to string and using ranges and everything else that i can find and nothing allows me to move the contents of one cell to another. it has to be a simple answer. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bob:
You have written a procedure and enclosed it with FUNCTION() ' a different breed of cat.. Replace (in a Standard module) with: Sub MV() Range("B2").ClearContents ' or cells(2,2).ClearContents Cells(2, 2) = Cells(2, 25) End Sub HTH "Bob Taylor" wrote in message ... Devin thanks for the info.. i had tried this and it failed. i recode it as Function MV() On Error GoTo bob Range("B3").ClearContents Range("B3").Value = Range("Y3").Value 'Cells(2, 2) = Cells(2, 25) bob: ' MsgBox " cannot store in old values" End Function it fails again. when i run with a stop on, and watch the cells it fails on first pass. however if i step into it again it works. i don't understand what is going on. bob "DMoney" wrote in message ... Give this a try. Range("B2").value = Range("B25").Value Devin "Bob Taylor" wrote: I get the error #VALUE! as a result of the following VB code Cells(2, 2) = Cells(2, 25). according to the examples and the books this should work and is very easy, but i can not make it work, the cell types are both GENERAL and the contents are strings. i have tried string to string and using ranges and everything else that i can find and nothing allows me to move the contents of one cell to another. it has to be a simple answer. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jim
my understanding of the difference between a function and a subprocedures is that the function returns a value and the sub doe not. i recoded the function to a sub and as i step through the sub, the range.clearcontents does not clear the content and then the range().value = range().value does not copy the data. the assignment statement should work in either wrappers without error. i am still looking for the root of the problem thanks bob "Jim May" wrote in message news:VoXwd.6771$jn.6741@lakeread06... Bob: You have written a procedure and enclosed it with FUNCTION() ' a different breed of cat.. Replace (in a Standard module) with: Sub MV() Range("B2").ClearContents ' or cells(2,2).ClearContents Cells(2, 2) = Cells(2, 25) End Sub HTH "Bob Taylor" wrote in message ... Devin thanks for the info.. i had tried this and it failed. i recode it as Function MV() On Error GoTo bob Range("B3").ClearContents Range("B3").Value = Range("Y3").Value 'Cells(2, 2) = Cells(2, 25) bob: ' MsgBox " cannot store in old values" End Function it fails again. when i run with a stop on, and watch the cells it fails on first pass. however if i step into it again it works. i don't understand what is going on. bob "DMoney" wrote in message ... Give this a try. Range("B2").value = Range("B25").Value Devin "Bob Taylor" wrote: I get the error #VALUE! as a result of the following VB code Cells(2, 2) = Cells(2, 25). according to the examples and the books this should work and is very easy, but i can not make it work, the cell types are both GENERAL and the contents are strings. i have tried string to string and using ranges and everything else that i can find and nothing allows me to move the contents of one cell to another. it has to be a simple answer. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
A function called from a worksheet cell can not change the excel environment
or change the value of other cells. It can only return a value to the cell in which it is located (just like builtin functions). -- Regards, Tom Ogilvy "Bob Taylor" wrote in message ... Jim my understanding of the difference between a function and a subprocedures is that the function returns a value and the sub doe not. i recoded the function to a sub and as i step through the sub, the range.clearcontents does not clear the content and then the range().value = range().value does not copy the data. the assignment statement should work in either wrappers without error. i am still looking for the root of the problem thanks bob "Jim May" wrote in message news:VoXwd.6771$jn.6741@lakeread06... Bob: You have written a procedure and enclosed it with FUNCTION() ' a different breed of cat.. Replace (in a Standard module) with: Sub MV() Range("B2").ClearContents ' or cells(2,2).ClearContents Cells(2, 2) = Cells(2, 25) End Sub HTH "Bob Taylor" wrote in message ... Devin thanks for the info.. i had tried this and it failed. i recode it as Function MV() On Error GoTo bob Range("B3").ClearContents Range("B3").Value = Range("Y3").Value 'Cells(2, 2) = Cells(2, 25) bob: ' MsgBox " cannot store in old values" End Function it fails again. when i run with a stop on, and watch the cells it fails on first pass. however if i step into it again it works. i don't understand what is going on. bob "DMoney" wrote in message ... Give this a try. Range("B2").value = Range("B25").Value Devin "Bob Taylor" wrote: I get the error #VALUE! as a result of the following VB code Cells(2, 2) = Cells(2, 25). according to the examples and the books this should work and is very easy, but i can not make it work, the cell types are both GENERAL and the contents are strings. i have tried string to string and using ranges and everything else that i can find and nothing allows me to move the contents of one cell to another. it has to be a simple answer. |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i just put an on error handler in and found Err.Number = 1004. where do you
find out what the 1004 really means. thanks "Jim May" wrote in message news:VoXwd.6771$jn.6741@lakeread06... Bob: You have written a procedure and enclosed it with FUNCTION() ' a different breed of cat.. Replace (in a Standard module) with: Sub MV() Range("B2").ClearContents ' or cells(2,2).ClearContents Cells(2, 2) = Cells(2, 25) End Sub HTH "Bob Taylor" wrote in message ... Devin thanks for the info.. i had tried this and it failed. i recode it as Function MV() On Error GoTo bob Range("B3").ClearContents Range("B3").Value = Range("Y3").Value 'Cells(2, 2) = Cells(2, 25) bob: ' MsgBox " cannot store in old values" End Function it fails again. when i run with a stop on, and watch the cells it fails on first pass. however if i step into it again it works. i don't understand what is going on. bob "DMoney" wrote in message ... Give this a try. Range("B2").value = Range("B25").Value Devin "Bob Taylor" wrote: I get the error #VALUE! as a result of the following VB code Cells(2, 2) = Cells(2, 25). according to the examples and the books this should work and is very easy, but i can not make it work, the cell types are both GENERAL and the contents are strings. i have tried string to string and using ranges and everything else that i can find and nothing allows me to move the contents of one cell to another. it has to be a simple answer. |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
1004 is a general error. More important is the descriiption provided with
the 1004 error. But as stated, what you are trying to do is not allowed in a User defined function used in a worksheet. -- Regards, Tom Ogilvy "Bob Taylor" wrote in message ... i just put an on error handler in and found Err.Number = 1004. where do you find out what the 1004 really means. thanks "Jim May" wrote in message news:VoXwd.6771$jn.6741@lakeread06... Bob: You have written a procedure and enclosed it with FUNCTION() ' a different breed of cat.. Replace (in a Standard module) with: Sub MV() Range("B2").ClearContents ' or cells(2,2).ClearContents Cells(2, 2) = Cells(2, 25) End Sub HTH "Bob Taylor" wrote in message ... Devin thanks for the info.. i had tried this and it failed. i recode it as Function MV() On Error GoTo bob Range("B3").ClearContents Range("B3").Value = Range("Y3").Value 'Cells(2, 2) = Cells(2, 25) bob: ' MsgBox " cannot store in old values" End Function it fails again. when i run with a stop on, and watch the cells it fails on first pass. however if i step into it again it works. i don't understand what is going on. bob "DMoney" wrote in message ... Give this a try. Range("B2").value = Range("B25").Value Devin "Bob Taylor" wrote: I get the error #VALUE! as a result of the following VB code Cells(2, 2) = Cells(2, 25). according to the examples and the books this should work and is very easy, but i can not make it work, the cell types are both GENERAL and the contents are strings. i have tried string to string and using ranges and everything else that i can find and nothing allows me to move the contents of one cell to another. it has to be a simple answer. |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
where is the entry
in your case try cells(2,25)=cells(2,2) does it help? cells(2,2) has already data and cells(2,25) is blank so you configure that cells(2,25) willhave the value of cells(2,2) Bob Taylor wrote in message ... I get the error #VALUE! as a result of the following VB code Cells(2, 2) = Cells(2, 25). according to the examples and the books this should work and is very easy, but i can not make it work, the cell types are both GENERAL and the contents are strings. i have tried string to string and using ranges and everything else that i can find and nothing allows me to move the contents of one cell to another. it has to be a simple answer. |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
it does not make any difference.
thanks though "R.VENKATARAMAN" &&& wrote in message ... where is the entry in your case try cells(2,25)=cells(2,2) does it help? cells(2,2) has already data and cells(2,25) is blank so you configure that cells(2,25) willhave the value of cells(2,2) Bob Taylor wrote in message ... I get the error #VALUE! as a result of the following VB code Cells(2, 2) = Cells(2, 25). according to the examples and the books this should work and is very easy, but i can not make it work, the cell types are both GENERAL and the contents are strings. i have tried string to string and using ranges and everything else that i can find and nothing allows me to move the contents of one cell to another. it has to be a simple answer. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Write formula for simple copy and paste to another cell | Excel Worksheet Functions | |||
Line copy - Not just a simple copy paste | Excel Worksheet Functions | |||
Simple Copy & Paste | Excel Programming | |||
Simple copy paste question | Excel Programming | |||
Simple copy and paste | Excel Programming |