Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default copy to new cells if populated

I'd like to copy a cell to another cell within the worksheet if it's
populated with a value. How do I set that up to run by it's self instead of
having me do it individually?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default copy to new cells if populated

Say we want to automatically copy from A1 to B9 once A1 is populated. Insert
the following event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set a = Range("A1")
Set b = Range("B9")
Set t = Target
If Intersect(t, a) Is Nothing Then Exit Sub
If t.Value = "" Then Exit Sub
Application.EnableEvents = False
a.Copy b
Application.EnableEvents = True
End Sub


Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm


--
Gary''s Student - gsnu200850


"srbow" wrote:

I'd like to copy a cell to another cell within the worksheet if it's
populated with a value. How do I set that up to run by it's self instead of
having me do it individually?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cells to be populated from an workbook to another. Fred's Excel Discussion (Misc queries) 1 March 12th 09 03:35 PM
Count only on visually populated cells Neall Excel Worksheet Functions 3 June 22nd 07 11:07 PM
Counting populated cells in another worksheet Fox via OfficeKB.com Excel Worksheet Functions 0 May 4th 07 03:11 PM
using IF function to copy, but leave populated cell alone [email protected] Excel Worksheet Functions 5 May 12th 06 10:39 PM
how do populate empty cells with the contents of populated cells . Jim99 Excel Discussion (Misc queries) 6 April 21st 05 05:44 PM


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

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

About Us

"It's about Microsoft Excel"