ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Worksheet_Change (https://www.excelbanter.com/excel-worksheet-functions/145948-worksheet_change.html)

Jive

Worksheet_Change
 
Hi I have what is probably the most basic question on the Worksheet_Change
module.
I need to write a script that copies a value from one cell to another when
another cell changes.

in this example I would like to change cell, L11, and have the script
replace the values in cells S11 and V11 with values from A1 and A2,
Similarly I would like to do the same for the range L11:L22 changing the
corresponding values S11:S22 and V11:V22 with the values from A1 and A2

Its probably really easy but I'm slowly learning the language and this seams
as good a place as any to start with worksheet events.

Thank you.

Don Guillett

Worksheet_Change
 
try this within your event

if target.address="$L$11 the
range("a1:a2").copy range("s11:s22,v11:v22")
end if


--
Don Guillett
SalesAid Software

"Jive" wrote in message
...
Hi I have what is probably the most basic question on the Worksheet_Change
module.
I need to write a script that copies a value from one cell to another when
another cell changes.

in this example I would like to change cell, L11, and have the script
replace the values in cells S11 and V11 with values from A1 and A2,
Similarly I would like to do the same for the range L11:L22 changing the
corresponding values S11:S22 and V11:V22 with the values from A1 and A2

Its probably really easy but I'm slowly learning the language and this
seams
as good a place as any to start with worksheet events.

Thank you.



Jive

Worksheet_Change
 
Im having problems getting it to work, i suspect its because i am trying to
paste over merged cells, cells "stu" are merged and so are "vwx" i tried
adding . paste to line 2 too

"Don Guillett" wrote:

try this within your event

if target.address="$L$11" then
range("a1:a2").copy range("s11:s22,v11:v22")
end if


--
Don Guillett
SalesAid Software

"Jive" wrote in message
...
Hi I have what is probably the most basic question on the Worksheet_Change
module.
I need to write a script that copies a value from one cell to another when
another cell changes.

in this example I would like to change cell, L11, and have the script
replace the values in cells S11 and V11 with values from A1 and A2,
Similarly I would like to do the same for the range L11:L22 changing the
corresponding values S11:S22 and V11:V22 with the values from A1 and A2

Its probably really easy but I'm slowly learning the language and this
seams
as good a place as any to start with worksheet events.

Thank you.





All times are GMT +1. The time now is 12:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com