• 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.

SharePoint/VBA/Excel

Rob.Zeiger

New Member
I am new to posting on this site so please bare with what could be rambling.
I have been tasked with cleaning up vba code in an excel spreadsheet so it is easier to work with. The spreadsheet resides online on a SharePoint site that is using multiple lists which in turn each use a separate sheet on the original spreadsheet to store data. The individual sheets all reference back to the first sheet of the document to display their data. The various columns I'm concerned with on the main sheet are employees (separated in each column by work group) and the client teams. An employee can be on multiple teams and my job is to display, when called on, only the rows that pertain to the employee (whether they are on a single team or multiple teams) and hide the rest of the rows.
Also if a client is selected only show the rows for that particular client and hide the rest. I have figured out how to hide/display rows for a particular client but and apply this to an employee provided they are only on one team. My problem is showing all of the rows for a client filtered by an employee if that employee is on multiple teams. I hope this makes sense. I know there has to be a much easier way than the code I'm attaching but, I have limited experience with VB code and can't quite wrap my head around this. I have attached sample code.
Code:
Sub CA()
'EMPLOYEE
' Cait Apple
'
'
    Call I
    Call G
'
End Sub

Sub I()
'CLIENT
' I Macro
'
'
    Rows("3:2000").Select
    Selection.EntireRow.Hidden = False
    Rows("50:2000").Select
    Selection.EntireRow.Hidden = True
    Range("J3").Select
End Sub


Sub G()
'CLIENT
' G Macro
'

'
    Rows("3:2000").Select
    Selection.EntireRow.Hidden = False
    Rows("4:49").Select
    Selection.EntireRow.Hidden = True
    Rows("96:2000").Select
    Selection.EntireRow.Hidden = True
    Range("J3").Select
End Sub
If I call I or G they work individually. Calling both together only displays one. I know it's because both client subs are hiding conflicting rows I just don't know how to fix it. Any help would be appreciated.
 
Last edited by a moderator:
Back
Top