+ Reply to Thread
Results 1 to 25 of 25

Populating a Worksheet with data entered on other worksheets

  1. #1
    Registered User
    Join Date
    01-21-2016
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    16

    Populating a Worksheet with data entered on other worksheets

    Hello Excel experts, :-)

    I'm hoping someone has done something similar or can be of assistance.

    I've a workbook I use to document expenses throughout the year.
    It has a sheet for each month of the year (ie Jan, Feb, Mar etc) & each sheet has a description of the purchases in one column, the cost of that purchase in the next, and the type of expense account(from a dropdown list) in the next column. Refer pic 1
    Pic 1- Purchases.png

    On another sheet called 'summary' it totals each account type by looking for a match on each worksheet, and if true, takes the value in the adjacent cell and adds it for the total spend so far for the year. Refer Pic 2
    Pic 2 - Summary.png

    On extra worksheets (Tools, Computer Equip, Office Equip, Stationary etc) I breakdown the total value for each account type with each purchase, taken from the 'monthly' worksheets so I can also see what the total for that account type was made up of. Refer Pic 3
    Pic 3 - Expense Account Details.png
    This part I'm doing manually at present by searching through and copying each purchase detail and cost for each account type, but would really love to have it automated with a macro or some other way so those worksheets (breakdowns of account purchases) are populated as the entries are entered into the 'monthly' worksheets.

    I currently have more than one account type on some of those 'detail' sheets and understand it could cause a problem having too many entries in regards to the number of rows available to each account type. I can change it to a sheet for each account type if need be.

    I hope that makes sense and I've attached snaps of each part I've referred to.

    Appreciate if someone can help me with this.
    Thankyou in advance to all that can.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Populating a Worksheet with data entered on other worksheets

    Hello and welcome to the forum.

    You are making the same mistake that I see time and time again. You are mixing up the two elements of data capture and final reporting. The two require quite different treatments.

    A lot of people start by designing the form that they expect to see as the final report or which at first glance seems the best way of capturing data, and then wonder why it's so difficult to subsequently analyse and summarise or extract information from it. Yours exhibits all those features.

    You should always capture data in a simple two dimensional table and worry about reporting information from it afterwards. Without exception doing this you will always be able to easily obtain management information. Rarely is this the case if you start the other way round.
    You will also throw open the whole wonderful world of the powerful Pivot table functionality.

    So before you get too far with this I'd create a single sheet database that contains the same columns as you already have on each monthly sheet but with the important difference that all your data is recorded on a single sheet. Forget about individual monthly sheets.

    The Expense Acc and Paid column values could be Validation drop down cells from which you could pick values. The way I normally arrange these things is to have a single data entry row above the database in which the new values are entered, then a button which runs a macro that adds the new record to the database.

    Once you have this single database sheet theb any analysis you could ever want is available in seconds with a Pivot Table
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    01-21-2016
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    16

    Re: Populating a Worksheet with data entered on other worksheets

    Hi Richard.
    Thank you very much for your reply.
    I should have firstly mentioned that I am a novice with Excel and don't quite understand a couple of things with your reply. Sorry.
    I will try to explain how I got to where it is now.

    Quote Originally Posted by Richard Buttrey View Post
    Hello and welcome to the forum.

    You are making the same mistake that I see time and time again. You are mixing up the two elements of data capture and final reporting. The two require quite different treatments.

    A lot of people start by designing the form that they expect to see as the final report or which at first glance seems the best way of capturing data, and then wonder why it's so difficult to subsequently analyse and summarise or extract information from it. Yours exhibits all those features.
    My original design was just the monthly sheets, so I had a representation of each months purchasing. And I could print each out at months end for reports.
    I then added the summary sheet of those expenses to know what was being spent as the year went on.
    Lastly, at years end, I find Im needing to collate the entries into some breakdown to print a report and justify what was spent on each account.
    Again, Ive not a lot of experience with this sort of thing, but if there's a better way to do it as you say, Then I'm happy to change whatever is required to make it better / work.


    Quote Originally Posted by Richard Buttrey View Post
    You should always capture data in a simple two dimensional table and worry about reporting information from it afterwards. Without exception doing this you will always be able to easily obtain management information. Rarely is this the case if you start the other way round.
    You will also throw open the whole wonderful world of the powerful Pivot table functionality.
    Pivot table is not something I've any experience with. :-/

    Quote Originally Posted by Richard Buttrey View Post
    So before you get too far with this I'd create a single sheet database that contains the same columns as you already have on each monthly sheet but with the important difference that all your data is recorded on a single sheet. Forget about individual monthly sheets.
    So one worksheet for all entries for the year?

    Quote Originally Posted by Richard Buttrey View Post
    The Expense Acc and Paid column values could be Validation drop down cells from which you could pick values. The way I normally arrange these things is to have a single data entry row above the database in which the new values are entered, then a button which runs a macro that adds the new record to the database.
    I do have both the 'Paid' and 'Expense Acc' columns as dropdown lists already.

    Quote Originally Posted by Richard Buttrey View Post
    Once you have this single database sheet theb any analysis you could ever want is available in seconds with a Pivot Table
    So are you saying all the data is entered in row 2 (in the attached pic) and the macro will 'load' it into the rows below one row at a time for the year?

    Thank you again for your help :-)
    Attached Images Attached Images

  4. #4
    Registered User
    Join Date
    01-21-2016
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    16

    Re: Populating a Worksheet with data entered on other worksheets

    Hello Richard / All

    I have had a look at the Pivot Tables Richard suggested and I can see the many reporting options available :-)

    With reference to the attached pic, can I get some assistance with a macro to load the data entered onto the database below it, if I've understood your suggestion correctly?

    Thank you :-)

    Single Database.png

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Populating a Worksheet with data entered on other worksheets

    Hi,

    Yes you have that exactly right. All you need now is

    1. Name the range A2:E2 say 'NewRecord'
    2. Add this macro in the Visual Basic Environment as a Module level macro - post back and upload your workbook if you need help with that
    Please Login or Register  to view this content.
    3. Add a button/shape to the sheet and Assign the macro 'AddRecord'.

  6. #6
    Registered User
    Join Date
    01-21-2016
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    16

    Re: Populating a Worksheet with data entered on other worksheets

    Hello again Richard

    Thank you for that code and assistance once more :-)
    I added it in and saw how it worked, then made a little change to the cell insert range so I could put my button between the database and where I enter the data.
    I also added Range("NewRecord").ClearContents to the end so it leaves the data entry range clear for a new entry.
    It certainly is a lot cleaner and obviously less time consuming than replicating all the monthly sheets I had been.

    Single Database.png

    One question I have on the Pivot Tables:
    Is it possible to initially set the Table's range so it expands as the database does? So if the table's on it's own worksheet
    I can select that sheet at anytime and manipulate what data I want to see for the different reports (and it would be up to date)
    Or do I need to set up a new pivot table (range) each time I want to view it to reflect the increased database range?

    Thanks :-)


    Just an update.
    Managed to make the table range dynamic by creating a name range (for the database) and adding the following offset formula via the name manager
    =OFFSET(Sheet1!$A$7,0,0,COUNTA(Sheet1!$A:$A),5) (Found how to with a google search)

    Don't seem to be able to see the changes reflected in the table with each data input though without either reopening the file (changed setting in table options to update on opening file), or creating a new table.

    I cannot see if there's somehow I can select the table and choose to update either.

    Can anyone inform me whether it's possible to have the table update instantly as the database is increased, or how I can update the contents of the table to reflect the new database range?

    Thank you.
    Last edited by ExcelSpreads; 01-23-2016 at 06:29 PM. Reason: Update

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Populating a Worksheet with data entered on other worksheets

    Richard appears to be off-line right now, so I will chip in a bit...

    Once you have the PT set up, all you need to do us update the table and it will bring in any updated (and I suspect, because it is Richard) any newly added data - no need to a new table when you change data. If Richard did not include what to do when new data is added, all you need to do is adjust the range in the Change Data Source under PT Tools tab

    On a side note, please upload a sample of your workbook, not a picture of your data. Pictures are pretty much impossible to edit, and no-one wants to re-type your data for you
    Also, not all members can upload picture files (Company firewalls and stuff) - and, depending on what browser is being used, some pics dont even show up on the forum
    Last edited by FDibbins; 01-24-2016 at 11:47 AM.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  8. #8
    Registered User
    Join Date
    01-21-2016
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    16

    Re: Populating a Worksheet with data entered on other worksheets

    Hi Ford

    Appreciate your reply

    Sorry, I added a little update to my earlier post to indicate where I'd progressed to. Must have been in the process of doing it when you replied.


    "adjust the range in the Change Data Source under PT Tools tab".... This will probably sound silly, but where do I find that? :-/

    Also, when you say to upload a sample of the workbook, are you saying to just upload an excel file? Instead of the pic. Or some type of html sample?

    Thankyou


    Edit...

    I still cant find the PT Tools Tab to change the data source, as you suggested, but the dynamic name range does seem to be working.

    I also haven't been able to find any way to reflect the database changes instantly in the table so I'm guessing I'm left with right clicking the table and refreshing each time I wish to look at it?

    Thank you :-)
    Last edited by ExcelSpreads; 01-23-2016 at 07:25 PM. Reason: Update

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Populating a Worksheet with data entered on other worksheets

    "adjust the range in the Change Data Source under PT Tools tab".... This will probably sound silly, but where do I find that? :-/
    Exactly where I said...while you are IN the PT, on the PT Tools Tab (you may need to click that tab again), under Data, look for the Change Data Source icon (8th or 9th icon from the left, right next to REFRESH)

    I also haven't been able to find any way to reflect the database changes instantly in the table so I'm guessing I'm left with right clicking the table and refreshing each time I wish to look at it?
    Yes, or use the REFRESH icon, I just metioned

  10. #10
    Registered User
    Join Date
    01-21-2016
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    16

    Re: Populating a Worksheet with data entered on other worksheets

    Ahhhhhhh.... 'folks are dumb where I come from...." lol
    Well I am anyway haha

    Now I see it. Yes, it appears if somewhere in the table is selected. I must have looked through the ribbon several times, but each time without the table selected.
    I do feel rather foolish. :-/
    Apparently the big brightly coloured pink 'Pivot Table Tools' tab is not as easy to see if you're me lol

    Thankyou very much, Ford. Appreciate your help :-)

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Populating a Worksheet with data entered on other worksheets

    Naaa if you don't know, you don't know...nothing to feel foolish about

    And it's not "big brightly coloured pink" unless you are IN the table

  12. #12
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Populating a Worksheet with data entered on other worksheets

    Hi,

    And thanks to Ford for the updates overnight.

    As it happens you don't need to worry about expanding the data range manually.
    I created a dynamic range name called 'Data' which will automatically adjust to cover new rows as you enter them.
    I also used the name 'Data' as the source of the PT and finally I added a line of code to the PT Sheet Activate event that will automatically refresh the PT every time you select the sheet. So you don't need to manually refresh the PT it will have refreshed automatically merely by looking at it.

  13. #13
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Populating a Worksheet with data entered on other worksheets

    ...further to #12. Apologies for any confusion. The post reads as though I had uploaded a workbook example. I'd replied to a very similar post to yours earlier where I had uploaded the workbook and had the two confused.

    I adapted the other workbook for your data and have now uploaded it here so that all the stuff I mentioned in #12 is present in this one. One improvement you could add is a simple 'ClearNewRecord' line of code, e.g.

    Please Login or Register  to view this content.
    to zap the new entry once it's been added to the table.
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    01-21-2016
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    16

    Re: Populating a Worksheet with data entered on other worksheets

    Thank you Richard :-)

    Your workbook looks a lot nicer than mine. I do like the row 7 freeze and the button is certainly more appealing as well.
    The database and table being dynamic is really great. Also the named ranges as well, I see :-)) so I can add more expenses/cards if the need arises.

    Thank you so much ! :-)

    There is one strange occurance that is happening though. Each time I open the file, the first four times I try to transfer data it is giving me something different in the database.. If I add the clear contents code, Im then getting 4 blank entries before the entered data appears...

    I'm sorry to annoy you still with this, but might you know why that may be happening?

    Thank you once again for your help :-)

  15. #15
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Populating a Worksheet with data entered on other worksheets

    Hi,

    What gets changed in the database when you choose to add a new record? i.e. what's in the new record range before you click the button and what appears in the database?

    I'm also struggling to understand why presumably it reverts back to normal after the first four open file events. Is this something that's happening in the example workbook I sent or in another workbook to which you've applied the same range names and functionality. If another workbook then upload it here so that I can see if it's replicated here.

  16. #16
    Registered User
    Join Date
    01-21-2016
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    16

    Re: Populating a Worksheet with data entered on other worksheets

    Richard,
    Please ignore what Ive said :-/

    I feel like an absolute goose.
    The following snapshot is taken on first opening the file after downloading.
    If you look at the row numbers all becomes clear where the extra four clicks came from before a new entry appeared in the database.

    Snap.png

    It must have been saved in that scrolled position. And I didn't scroll up and down until after i'd been testing the button obviously. Hence the reason it didn't appear to do it afterwards.
    On exiting I never saved the file and therefore experienced it again when I opened it. On downloading the workbook again, testing the button once more, and yep,, it does it lol
    Took some time for the penny to drop :-/

    So please ignore my earlier request.

    This is working flawlessly and I really am impressed at how much I can manipulate the table to show whatever I want :-)
    You've created the workbook for me such that I don't have to do anything other than put entries in.
    Thank you so much!


    And thank you also @Ford for your help.


    I very much appreciate it :-)
    Last edited by ExcelSpreads; 01-24-2016 at 06:43 PM. Reason: More info

  17. #17
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Populating a Worksheet with data entered on other worksheets

    Hi,

    Is this happening with the workbook I uploaded in #13? I ask since you mention 'after I add the line of code'. The clear.contents code is already present.

  18. #18
    Registered User
    Join Date
    01-21-2016
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    16

    Re: Populating a Worksheet with data entered on other worksheets

    Sorry Richard, I was editing my earlier post to explain there was nothing wrong and just noticed you've replied.

    It works perfect :-)

    Thank you very much indeed :-)

  19. #19
    Registered User
    Join Date
    01-21-2016
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    16

    Re: Populating a Worksheet with data entered on other worksheets

    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    Is this happening with the workbook I uploaded in #13? I ask since you mention 'after I add the line of code'. The clear.contents code is already present.
    Richard,
    The workbook you put up for me didn't have that code present.

    Refer snapshot of newly downloaded file:
    Code1.png


    You did provide it for me to add in though and I added it to the very next line of code

    This is where I place it:
    Code2.png


    What I HAVE noticed though is that as soon as I add that code, and then do a data entry and add it to database, my pivot table total is $6 short.
    For some reason the total has dropped the very first entry (ie Jan 1st, mmm clothes $6)
    I believe it's this one because if i change the value and do it again (on a newly downloaded file from scratch) it's the new value that's short after I add the code.

    This is happening on the workbook you uploaded for me, straight from downloading.

    My apologies I'm still annoying you :-/

  20. #20
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Populating a Worksheet with data entered on other worksheets

    If it's dropping the first record then that will be because the dynamic range name 'Data' is not defined correctly and doesn't start with the row that contains the column labels. Check that first and correct if necessary. Otherwise upload your workbook so that I can check.

  21. #21
    Registered User
    Join Date
    01-21-2016
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    16

    Re: Populating a Worksheet with data entered on other worksheets

    Hi Richard,

    I looked at the code. I believe Data Range starts at b7 but Im not sure of the rest.

    Workbook attached.

    Purchase Details.xlsm


    As I stated, with the file as it is downloaded, it works correctly. As soon as the Range("NewRecord").ClearContents code is added
    it appears to leave off that first record each time.

    Thanks

    Edit:
    I hope the file is attached properly. It doesnt appear the way your attachment did when you uploaded it. Am I doing something wrong?
    Last edited by ExcelSpreads; 01-25-2016 at 06:30 AM. Reason: Attachment working?

  22. #22
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Populating a Worksheet with data entered on other worksheets

    Hi,

    Seems to work OK for me. Are you sure you're not being confused by the FreezePanes. Can you clarify what you mean by 'leaves off the first record'. i.e. note what's on row 8 BEFORE you add the new record. After the new record is added what's now on row 9. This should be what was originally on row 8.

  23. #23
    Registered User
    Join Date
    01-21-2016
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    16

    Re: Populating a Worksheet with data entered on other worksheets

    Hi Richard

    The record in row 24 is the one that seems affected. It remains there but it's value doesn't seem to be included after the clearcontents code is added.



    The workbook I uploaded doesnt have the clearcontents code added yet, it is exactly as you uploaded it for me.
    If the file is opened and used without changing any code it appears to behave correctly.

    Albeit it doesn't clear the data in the 'newrecords' range.



    So to try and explain where it occurs, doing the following reproduces it...
    I open the file that I download. (as you uploaded it)
    I look at the Pivot table worksheet and note the total is $192 which is the correct sum of the entries currently within the database.
    Before doing anything else, load the range clearcontents code within the existing macro (as i've shown in post #19).
    Then hit the Macro button to load the new data (tools $123 as it is already there) into the database, and the new value in the pivot table should have increased by $123 to a new total of $315, but it doesn't. It only increases to $309 ($6 short)

    Ive tried this again with a clean file from scratch, changing the value in E24 to $10 instead of $6 before adding the clearcontents code, and the sum will be out by $10 instead of $6. That's why I believe it's that row that is the problem.


    So I'm thinking it has something to do with me putting that line of code in. :-/

    Hopefully that makes what I'm trying to explain a little clearer.

    Thanks

  24. #24
    Registered User
    Join Date
    01-21-2016
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    16

    Re: Populating a Worksheet with data entered on other worksheets

    Further to my post #23 above, what I've found is as below:

    On opening the file, a check of the 'DATA' range with the name manager indicates it is correct and includes all rows with entries.
    Delete the entry in cell B3 and a check on the 'Data' range reveals it is one row smaller (row 24 is no longer included)
    So as soon as the clearcontents code is added to the macro, the 'DATA' Range is no longer the complete database, and that
    is why the Pivot Table total sum is incorrect.

    Is there a way that can be rectified or will I need to clear the first row (B24 being the first entry to the database) and leave it empty?
    Actually that doesn't work unless something is in cell B24 (like 'leave empty' or similar)

    Hope that makes things even clearer..Thanks again :-)

    Does anyone have any thoughts on this?

    Workbook attached :

    Purchase Details.xlsm

  25. #25
    Registered User
    Join Date
    01-21-2016
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    16

    Re: Populating a Worksheet with data entered on other worksheets

    Hi Richard,

    Just checking to see if you felt there was a way around the problem I pointed out in
    my previous post #24?

    ie. Whether the database size can be consistent with all the entries or whether I'll need
    to remember and accomodate for the bottom row being dropped off the database whenever the
    contents of the 'newrecord' entry row is cleared.


    Thank you again for all your help with this.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Populating rows with formulas when new data is entered
    By sungen99 in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 05-15-2015, 01:35 PM
  2. Replies: 2
    Last Post: 09-27-2014, 02:51 PM
  3. Populating VBA userform and Fetch previously entered data edit and make new entry
    By vijaynadiad in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-07-2013, 11:59 AM
  4. Populating sheets from entered data
    By Tim Challen in forum Excel General
    Replies: 7
    Last Post: 08-26-2011, 04:08 AM
  5. Auto Populating Individual Worksheets based on Main Worksheet
    By brickford5 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-16-2011, 05:01 PM
  6. populating other worksheets with data dynamically
    By ikthius in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-01-2009, 07:42 AM
  7. Populating data into Worksheets
    By Varmintcong in forum Excel General
    Replies: 1
    Last Post: 04-08-2008, 09:58 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1