Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9038055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:23:45+00:00 2026-06-16T09:23:45+00:00

I am using excel 2010. I have a sheet named ‘LOG’ in which there

  • 0

I am using excel 2010.
I have a sheet named ‘LOG’ in which there is a log of all the employee like this:

Example Data

Now I have another sheet named sheet1.
What I would like is a macro that should prompt for employee id and month, then display all the log of that employee for that particular month.

I have tried a lot of things but couldn’t do it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T09:23:46+00:00Added an answer on June 16, 2026 at 9:23 am

    The following code will list the results in the column specified by the RESULTS_COLUMN constant value, just add the following code to your worksheet. You’ll also need 3 named ranges – EmployeeCode, StartDate and EndDate – to input your criteria, though you could always prompt for these another way:

    Sub DisplayRecords()
    
    Const RESULTS_COLUMN As Long = 5
    
    Dim strEmployeeCode As String
    Dim dtStartDate As Date, dtEndDate As Date
    
    Dim c As Range
    
        On Error GoTo ErrorTrap
    
        strEmployeeCode = [EmployeeCode]
        dtStartDate = [StartDate]
        dtEndDate = [EndDate]
    
        ' Clear the results column
        With Sheet1
            .Columns(RESULTS_COLUMN).ClearContents
            .Cells(1, RESULTS_COLUMN).Value = "Results"
            .Cells(1, RESULTS_COLUMN).Font.Bold = True
        End With
    
        For Each c In Sheet1.UsedRange.Columns(1).Cells
            If c.Value = strEmployeeCode And c.Offset(, 1) >= dtStartDate And c.Offset(, 1) <= dtEndDate Then
                ' Find the next available cell in results column
                Sheet1.Cells(Sheet1.Rows.Count, RESULTS_COLUMN).End(xlUp).Offset(1).Value = c.Offset(, 1).Value
            End If
        Next c
    
        Exit Sub
    
    ErrorTrap:
        MsgBox "An error has occurred, please check input criteria", vbExclamation, ThisWorkbook.Name
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this as a few cells in excel 2010: (source: gyazo.com ) There
I'm using Excel 2010, which includes the SUMIFS function. My spreadsheet is in this
I have the following function using Excel 2010: Private Function MakeAllSheetsValuesOnly(targetBookName As String) If
I'm using Excel VBA and have a worksheet_change event like so: Private Sub Worksheet_Change(ByVal
I'm using Excel 2010. I'm trying so save my excel file, with this code.
I have get the date from excel sheet using POI using the below code,
I have an excel import from ODBC setup using MSQuery and all of the
In VBA (Excel 2010), I am dynamically creating a named range list using that
I have a shared Excel worksheet (using .XLS due to compatibility issues), which I
I'm using Excel 2010 and I have a macro that needs to load OData

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.