Consulting

Results 1 to 2 of 2

Thread: display records by office

  1. #1

    display records by office

    I am a newbie in Excel/VBA.
    would you please help me to figure out this project.
    First, get the data from source.
    Second, Display the data based on office in the certain office place in Result sheet.
    see attached excel file. would you help me
    the following is so far what I done;
    Sub ExtractDept()
        Dim i As Integer
        Dim intCount As Integer
        Dim strDept As String
        Dim startpoint As String
        Dim Msg As String
        Dim rngCell As Range
        Dim strYesNo As String
        Application.DisplayAlerts = False
        'reference the range;NQ,SR,GP,WR,CC,DC
        strDept = Range(OFFICE)
        'startarea=NQ,SR,GP,WR,CC,DC
        startpoint = Range(startarea)
        'In a certain office area, paste records according to Office In Result sheet
        
        Sheets(strDept & "Sheet").Range("a1").Select
        ActiveSheet.Paste
        
        Do While Range("start").Offset(i, 1) <> ""
            If Range("start").Offset(i, 1) = strDept Then
              ' go to startpoint place ; startarea=strDept
              Range(Range("start").Offset(i, 0), Range("start").Offset(i, 4)).Copy
                intCount = intCount + 1
                sht.Range("a1").Offset(intCount, 0).Select
                sht.Paste
            End If
            i = i + 1
        Loop
        
        Columns.AutoFit
        ActiveWindow.DisplayGridlines = False
        
        
    End Sub

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Thread moved to Excel Help forum
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

Posting Permissions

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