ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Transfer value to cell (https://www.excelbanter.com/excel-programming/304164-transfer-value-cell.html)

Phil Floyd

Transfer value to cell
 
In cell D30 I will enter a number. I would like for that number to appear
in cell M30 then have the word "Material" to appear in cell D30. Below is
what I am trying to work with, but I always get "Material" in both D30 and
M30. How do I fix this?

Thanks,
Phil

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$D$30" Then
Range("M30") = Range("D30")
Range("D30") = "Material"
End If
End Sub



Phil Floyd

Transfer value to cell
 
Thanks Frank. It works great.
Phil

"Frank Kabel" wrote in message
...
Hi
You have to disable the worksheet events as otherwise your
macro entry will trigger this event again. try
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$D$30" Then
application.enableevents=false
Range("M30").value = target.value
Range("D30").value = "Material"
End If
application.enableevents=true
End Sub

-----Original Message-----
In cell D30 I will enter a number. I would like for that

number to appear
in cell M30 then have the word "Material" to appear in

cell D30. Below is
what I am trying to work with, but I always

get "Material" in both D30 and
M30. How do I fix this?

Thanks,
Phil

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$D$30" Then
Range("M30") = Range("D30")
Range("D30") = "Material"
End If
End Sub


.





All times are GMT +1. The time now is 01:25 PM.

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