change cells on cell change

N

nelsok

I have this code


Code:
--------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$b$3" Then
Sheets("Sheet2").Range("a1:a5") = Sheets("Sheet2").Range("b1:b5")
End If
End Sub
--------------------


When cell b3 is changed i want to replace what is in a1:a5 with what is
in b1:b5

any ideas?
 
R

Rick Hansen

nesok, Try putting your code in the WorkSheet_Change() event.

something like this (see below). This event fires when there has been change
in the Target address.
HTH , Rick


Private Sub Worksheet_Change(ByVal Target as Range)
If Target.Address = "$b$3" Then
Sheets("Sheet2").Range("a1:a5") = Sheets("Sheet2").Range("b1:b5")
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top