+ Reply to Thread
Results 1 to 3 of 3

Vba code to update range on multiple worksheets

  1. #1
    Registered User
    Join Date
    10-10-2011
    Location
    Cardiff
    MS-Off Ver
    Excel 2010
    Posts
    8

    Vba code to update range on multiple worksheets

    Hi guys,
    I've been reading this forum for a while now, picking up some great tips along the way too but this is my first post on here.
    I'm very much a novice when it comes to vba so any help with the following problem will be greatly appreciated. I have a 2 part question:

    I have a spreadsheet (simplified example attached) consisting of 2 w/s where I keep a record of employee non-attendance days.
    Sheet 1 ('Data') has a table of consisting of 5 colums with the following headers (Depts, Name, Surname, Hols, Sick, Req'd)
    Each column has a named range.
    On Sheet 2 ('Update'), I have a dropdown list that will select Dept names

    Part 1
    When I select a Dept Number from the dropdown list, I want the table to populate with the corresponding data from the table on Sheet 1 ('Data')
    I have it working using formulas but is there a way this can be achieved using vba code (macro)? - This is purely for educational purposes.
    I've used data validation to populate the dropdown but can change this if this can be done using vba code

    Part 2
    When I update the highlighted information, is there a way that the corresponding figures on 'Data' (highlighted) can also be updated depending on which Dept is selected (again using vba/macro)?

    The actual worksheet consists of an average of 35 names per Dept and covers 8 Depts so there is a lot of data to enter.
    To date I have been using the advanced filter but I want to acheive the above if its possible

    Thanks in advance,

    regards,
    H
    Attached Files Attached Files
    Last edited by hbomb1927; 10-21-2011 at 01:24 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Vba code to update range on multiple worksheets

    I've added some named ranges to each sheet to make this simple, then a standard worksheet_change macro in the Update Sheet module does the rest.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    10-10-2011
    Location
    Cardiff
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Vba code to update range on multiple worksheets

    JBeaucaire, thanks for the quick response.

    That is exactly what I needed and the bi-directional option is a bonus.

    Many thanks.

    regards.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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