Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Please help me, my question is the following: How can i create a function in Excel/VBA which copy the value in a cell that is not the cell in which the function is executed and paste this value in another cell? I tried the following: function transfer(cell1,cell2) range("cell1").select selection.copy range("cell2").select activesheet.paste end function But i got no success, please help me -- terminator_ba ------------------------------------------------------------------------ terminator_ba's Profile: http://www.excelforum.com/member.php...o&userid=35511 View this thread: http://www.excelforum.com/showthread...hreadid=552826 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
terminator_ba wrote:
Please help me, my question is the following: How can i create a function in Excel/VBA which copy the value in a cell that is not the cell in which the function is executed and paste this value in another cell? I tried the following: function transfer(cell1,cell2) range("cell1").select selection.copy range("cell2").select activesheet.paste end function But i got no success, please help me The problem with this is that the function would not know when it was supposed to do this. If cell1 was A1 and cell2 was B2 then you could just put =A1 in B2 Or you could change the function to a sub like this: sub transfer(cell1,cell2) range(cell2).value = range(cell1).value end sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() i will try to be clear, i want to copy the value in A1 and paste it in B1 ONLY if a condition is true. If this condition is true, the value of A1 is copied into B1 , but if the condition is false, it doesnt happen anything, the value in B1 is kept. Well I tried to insert the following function in B1: =If(c1<0;a1) but it returns a False in B1 cell if the condition is false. I want it to return a value only if the condition is true, and if the condition is false, it keeps the old value. Its like a register do you understand? -- terminator_ba ------------------------------------------------------------------------ terminator_ba's Profile: http://www.excelforum.com/member.php...o&userid=35511 View this thread: http://www.excelforum.com/showthread...hreadid=552826 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
terminator_ba wrote:
i will try to be clear, i want to copy the value in A1 and paste it in B1 ONLY if a condition is true. If this condition is true, the value of A1 is copied into B1 , but if the condition is false, it doesnt happen anything, the value in B1 is kept. Well I tried to insert the following function in B1: =If(c1<0;a1) but it returns a False in B1 cell if the condition is false. I want it to return a value only if the condition is true, and if the condition is false, it keeps the old value. Its like a register do you understand? How's about something like: in B1: =IF(C1<0;A1;'value you want in b1') |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
G'day there Peepuls,
[This followup was posted to microsoft.public.excel.programming and a copy was sent to the cited author.] in B1: =IF(C1<0;A1;'value you want in b1') I think that should be "=IF(C1<0, A1, 'value you want it b1')". Commas, not semi-colons. (Paul I think you typed too fast <g) See ya Ken McLennan Qld, Australia |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ken McLennan wrote:
G'day there Peepuls, [This followup was posted to microsoft.public.excel.programming and a copy was sent to the cited author.] in B1: =IF(C1<0;A1;'value you want in b1') I think that should be "=IF(C1<0, A1, 'value you want it b1')". Commas, not semi-colons. (Paul I think you typed too fast <g) See ya Ken McLennan Qld, Australia No, I copied what the OP had used thus: "...Well I tried to insert the following function in B1: =If(c1<0;a1) but it returns..." |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formula Creation via Add-in problem | Excel Programming | |||
Problem with chart creation. | Charts and Charting in Excel | |||
Problem with chart creation | Excel Discussion (Misc queries) | |||
Ultimate circular problem for chart creation | Excel Discussion (Misc queries) | |||
Automatic Number Creation Problem? | Excel Worksheet Functions |