A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Copy contents of a cell into a blank cell



 
 
Thread Tools Display Modes
  #1  
Old January 8th, 2010, 05:41 PM posted to microsoft.public.excel.worksheet.functions
fire9990
external usenet poster
 
Posts: 2
Default Copy contents of a cell into a blank cell

How do I copy the contents of cell B2 into cell D2 only if D2 is empty
  #2  
Old January 8th, 2010, 05:50 PM posted to microsoft.public.excel.worksheet.functions
Roger Govier[_3_]
external usenet poster
 
Posts: 2,297
Default Copy contents of a cell into a blank cell

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 tabView Code
Paste code into white pane that appears
Alt+F11 to return to Excel
--
Regards
Roger Govier

"fire9990" wrote in message
...
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



  #3  
Old January 8th, 2010, 05:58 PM posted to microsoft.public.excel.worksheet.functions
Gord Dibben
external usenet poster
 
Posts: 20,252
Default Copy contents of a cell into a blank cell

See replies to your first posting.


Gord Dibben MS Excel MVP

On Fri, 8 Jan 2010 08:41:01 -0800, fire9990
wrote:

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


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:28 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.