Copy contents of a cell into a blank cell

R

Roger Govier

Hi

It cannot be done with a formula - only with VBA.
The following code should achieve what you described

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$D$2" Then
If Range("D2") = "" Then Range("D2") = Range("B2").Value
End If
End Sub


To Use
Copy Code above
Right click on sheet tab>View Code
Paste code into white pane that appears
Alt+F11 to return to Excel
--
Regards
Roger Govier

fire9990 said:
How do I copy the contents of cell B2 into cell D2 only if D2 is empty

__________ Information from ESET Smart Security, version of virus
signature database 4754 (20100108) __________

The message was checked by ESET Smart Security.

http://www.eset.com

__________ Information from ESET Smart Security, version of virus signature database 4754 (20100108) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 

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