• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Copying data to another sheet if data exists (using MACRO)

harry71152

New Member
Hi there,


I have a worksheet which contains certain sections. I want to create a macro which will run if data is input into those sections. This macro should copy whatever was entered into another worksheet automatically as data is being entered. Is there a way for that?


Please help!!


Thanks
 
Sorry about that!!! So, I have a workbook that contains two sheets. As new sheets are added and data is entered into those sheets, the data should also be copied to one of the two original sheets.


For example, the two original sheets are "Totals" and "Time Sheet". I add a sheet with weekly hours (every week a new sheet is added). The data in the new sheet should be copied to "Time Sheet" every time it's entered.


I hope that's a bit more clear!!
 
Hi, harry71152!


First of all welcome to Chandoo's website Excel forums. Thank you for your joining us and glad to have you here.


As a starting point I'd recommend you to read the green sticky topics at this forums main page. There you'll find general guidelines about how this site and community operates (introducing yourself, posting files, netiquette rules, and so on).


Among them you're prompted to perform searches within this site before posting, because maybe your question had been answered yet.


Feel free to play with different keywords so as to be led thru a wide variety of articles and posts, and if you don't find anything that solves your problem or guides you towards a solution, you'll always be welcome back here. Tell us what you've done, consider uploading a sample file as recommended, and somebody surely will read your post and help you.


And about your question...


If you haven't performed yet the search herein, try going to the topmost right zone of this page (Custom Search), type the keywords used in Tags field when creating the topic or other proper words and press Search button. You'd retrieve many links from this website, like the following one(s) -if any posted below-, maybe you find useful information and even the solution. If not please advise so as people who read it could get back to you as soon as possible.


And regarding this topic...


This topic is the same as last question of this, just a few minutes of difference:

http://chandoo.org/forums/topic/creating-a-new-sheet-and-copying-its-data-to-an-existing-sheet-using-macros


So you should have continued posting on same topic, otherwise...


What you're doing "is called cross-posting and is generally frowned upon in the Blogosphere as it causes people to potentially waste our time when a question is already answered. You should also check and respond to posts and let posters know if they are heading in the write direction or not." Hui's dixit, SIC. And I agree 101%.


If you'd have read the first green sticky posts at this forums main page...

http://chandoo.org/forums/topic/phd-forum-posting-rules-etiquette-pls-read-before-posting

...you should have noticed this points:


"Never title your posts as "Urgent", "Priority" "Immediate". It may be Important to you, but not for rest of the members here. These words will be moderated out."


"Consider that the world is operating 24hrs a day. A late post today may well be answered by someone else overnight."


"Cross Posting, generally it is considered poor practice to cross post, that is to post the same question on several forums in the hope of getting a response quicker."


"If you do cross post, please put that in your post."


"Also if you have cross posted and get an answer elsewhere, have the courtesy of posting the answer here so other readers can learn from the answer also, as well as stopping people wasting there time on your answered question."


"If you and a reader have been involved in an ongoing conversation and the conversation suddenly stops, recognize that the person may have gone to bed, even though you have just arrived at work. In the worst case a reader may go on holidays and not get back to the question for a few days."


"Say "Thanks", whenever you can. Recognize when someone has bothered to go to the trouble and time to assist you with your question. Often readers will spend several hours working on a solution to a problem, a line of recognition will go a long way."


Regards!
 
Hello. Thanks for the welcome. I did try the search engine and was unable to find a problem similar to mine. And you're right, the earlier question I posted was similar but since then, I had figured out a little bit of the solution. I wasn't sure if I still had to post it in the same thread or create a new one. But, if I was wrong, I apologize. But, the situation is that I still don't have a solution for my problem. As I'm still unable to copy the date to the worksheet I want when the data is changed/modified. I did make some progress and was able to create a code for the macro but it copies the data in a new window (something I don't want).


Here's the code:


Private Sub Worksheet_Change(ByVal Target As Range)


If Not Intersect(Target, Range("A1:AB75")) Is Nothing Then Copy


End Sub


Sub DidCellsChange()

Dim KeyCells As String

' Define which cells should trigger the KeyCellsChanged macro.

KeyCells = "A1:AB75"


' If the Activecell is one of the key cells, call the

' KeyCellsChanged macro.

If Not Application.Intersect(ActiveCell, Range(KeyCells)) _

Is Nothing Then KeyCellsChanged


End Sub


Sub KeyCellsChanged()

Dim LastRow As Integer


'Where is the last cell with data?

LastRow = ActiveWorksheet.Range("A1:AB75").End(xlUp).Row


'Transfer data

ActiveWorksheet.Range("A1:AB75").Copy Worksheets("Time Sheet 1").Cells(LastRow + 1, "A")


End Sub


Please help!!
 
Back
Top