Consulting

Results 1 to 10 of 10

Thread: Macro help!

  1. #1

    Macro help!

    Hi,

    I have spreadsheet for each employees, there are three tabs

    first employee - Ron, his table looks this way

    SL #

    Activitystart dateend dateStatus1Improve GSC process2/2/20113/22/2011Pending2Budget 20113/2/20113/22/2011Pending





    second employee - Sam, his table looks this way

    SL #

    Activitystart dateend dateStatus1KPI's for supply chain3/3/20113/15/2011Completed2Budget 20113/2/20113/22/2011Pending3schedule for branches3/12/20113/15/2011Pending




    third employee - Shawn, his table looks this way

    SL #

    Activitystart dateend dateStatus1Improve GSC process2/2/20113/22/2011Pending2Budget 20113/2/20113/22/2011pending





    I need to consolidate the above data in one sheet as masterfile, this way

    SL #

    Activitystart dateend dateRonSamShawn1Improve GSC process2/2/20113/22/2011Pending Pending2KPI's for supply chain3/3/20113/15/2011 completed 3Budget 20113/2/20113/22/2011PendingPendingPending4schedule for branches3/12/20113/15/2011 Pending





    I need a macro, as and when the data is entered in the employee sheet, the master file should update on its own.

    Please let me know if you have any question, appreciate your help

    Thanks,
    Ron....

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Ron
    Welcome to VBAX
    You can post a sample workbook using Manage Attachments in the Go Advanced reply section. Can you show sample data and the desired result?
    Regards
    MD
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3

    Macro Help

    Hello....

    Thank you!!

    I have attached a sample spreadsheet
    Attached Files Attached Files

  4. #4
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Without a macro, in E2 enter
    =IF(ISNA(VLOOKUP($B2,INDIRECT("'" & E$1 & "'!$B:$E"),4,0)),"",VLOOKUP($B2,INDIRECT("'" & E$1 & "'!$B:$E"),4,0))
    copy across and down
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5
    Hi,

    Thank you for the reply!!

    I still have one problem, in masterfile the formula works under column E, F and G..thats awesome!! ...unfortunately doesnt meet my requirement

    For example :- I have added a field under RON, but I dont see anything under masterfile, Its blank.

    I want the field

    3prepare roq3/2/20113/22/2011Pending

    (entered under the tab Ron)

    which I have entered under Ron..to be automatically updated in masterfile. unfortunately its blank.. I have updated the spreadhseet with the recent formula..hope this explaination helps!
    Attached Files Attached Files

  6. #6
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    For something like this to work, you need consistent activity names between the master sheet and all other sheets. This is best done by maintaining one activity list and using data validation to allow only those values to be entered. This would apply to Macros or Formulae.
    With regard to Dates, I don't see how you can return conflicting dates from 3 sheets.
    I think you should plan further the best way to insert new data and update existing.
    Attached Files Attached Files
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  7. #7
    I have a code which executes, but have two problems, the code executes only for 3 tabs but I want the code to execute for 10 tabs.

    next problem is, in any tab when I enter it reflects in masterfile, but when I delete something in the tab, masterfile still shows the data.

    I have attached spreadsheet, and also the code

    Regards,
    Vikas
    Attached Files Attached Files

  8. #8
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    There is no code in the workbook
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  9. #9
    Ooops!!! Sorry, had sent you the old file, please check it now

    Thank you
    Attached Files Attached Files

  10. #10
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Either you need to hard code your sheet names or otherwise organise/distinguish them so that Name sheets can be counted. This assumes Name Sheets follow the Master sheet and there is a final "extra sheet" as per your example. BTW, If you got your code at another site, please give a link to that location, and a link there to this thread.

    [VBA]Private Sub Worksheet_Activate()
    Dim Wsht As Variant
    Dim Rng As Range, Dn As Range, n As Long
    Dim Sh As Integer
    Dim Col As Integer
    Dim Shts As Long
    Dim i As Long


    Shts = Worksheets.Count - 1
    ReDim Ray(1 To Rows.Count, 1 To 4 + Shts)
    Ray(1, 1) = "SL#": Ray(1, 2) = "Activity": Ray(1, 3) = "Start Date"
    Ray(1, 4) = "End Date"

    For i = 2 To Shts
    Ray(1, 3 + i) = Sheets(i).Name
    Next

    n = 1
    With CreateObject("scripting.dictionary")
    .CompareMode = vbTextCompare
    For Sh = 2 To Shts
    With Sheets(Sh)
    Set Rng = .Range(.Range("B2"), .Range("B" & Rows.Count).End(xlUp))
    End With
    For Each Dn In Rng
    If Not .Exists(Dn.Value) Then
    n = n + 1
    .Add Dn.Value, n
    Ray(n, 1) = n - 1
    Ray(n, 2) = Dn
    Ray(n, 3) = Dn(, 2)
    Ray(n, 4) = Dn(, 3)
    Ray(n, Sh + 3) = Dn(, 4)
    Else
    Ray(.Item(Dn.Value), Sh + 3) = Dn(, 4)
    End If
    Next Dn
    Next Sh
    End With
    With Sheets("Master File")
    .Range("A1").Resize(n, 4 + Shts) = Ray
    End With
    End Sub[/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

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