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 9122583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:08:16+00:00 2026-06-17T06:08:16+00:00

I have a spreadsheet where our organisation is required to submit sickness information on

  • 0

I have a spreadsheet where our organisation is required to submit sickness information on a weekly basis for staff. The spreadsheet has one tab for each week of the year and I already have a macro to copy employee details from one week to the next.

I’m attempting to build in the code below where it picks up staff who are still on sick leave and copies the start date of the sickness period to the following week. The code works by picking up an employee number as a string in the loop, then creating an object for the start date.

Due to the layout and other information on the templates I can’t simply copy and paste the whole sheet from one week to the next.

REVISED
The revised code below now copies the first SicknessStart date to NextWeek. However it only works on the first date and won’t copy the information from the subsequent rows for some reason. The date format is also copying accross in US format but I’m looking into that.

Sub CopyDate

 Dim I As Integer, CopyDate As Boolean
 I = 6
 CopyDate = False

 'Use the Employee Number column (C) to perform the check on the sickness dates
 Do While CurrentWeek.Cells(I, 3) <> ""

'Check if there is a sickness start date in column R
If CurrentWeek.Cells(I, 18) <> "" Then
'Check if they have entered 'Still Away' or left the cell blank in column S
    If CurrentWeek.Cells(I, 19) = "Still Away" Or CurrentWeek.Cells(I, 19) = "" Then

        Dim EmployeeNumber As String
        Dim SicknessStart As String
            EmployeeNumber = Cells(I, 3)
            SicknessStart = Cells(I, 18)

        NextWeek.Select

'Find the employee number string on the following week's tab and enter sickness start date   
        Columns(3).Find(What:=EmployeeNumber, LookIn:=xlValues, LookAt:= _
        xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
        , SearchFormat:=False).Offset(0, 15) = SicknessStart

End If
End If

I = I + 1
Loop
CopySickness = True
End Sub
  • 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-17T06:08:17+00:00Added an answer on June 17, 2026 at 6:08 am

    You don’t show how CurrentWeek or NextWeek are declared or set. I’ll assume they are global worksheet variables (a bad idea by the way, they should be parameters passed into this sub) that are set elsewhere.


    Then qualify all cell references with one or the other.

            EmployeeNumber = CurrentWeek.Cells(I, 3)
            SicknessStart = CurrentWeek.Cells(I, 18)
    

    This line is the cause of your problems (delete it)
    Why? Because on the second time through the unqualified EmployeeNumber = Cells(I, 3) etc refer to sheet NextWeek

    NextWeek.Select
    

    Finding the Employee number using a Range variable

    Dim rStartDate as Range
    
    ' replace your Columns(3).Find(... code with this
    Set rStartDate = NextWeek.Columns(3).Find( _
      What:=EmployeeNumber, _
      LookIn:=xlValues, _
      LookAt:=xlWhole, _
      SearchOrder:=xlByRows, _
      SearchDirection:=xlNext, _
      MatchCase:=False, _
      SearchFormat:=False)
    If Not rStartDate Is Nothing Then
        rStartDate.Offset(0, 15) = SicknessStart
    Else
        ' EmployeeNumber is not found in NextWeek.Column(3)
    End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a spreadsheet that our office uses for scheduling. Each tab represents a
I have a spreadsheet that has several worksheets, each containing a hundred or so
I have an Excel spreadsheet that uses a TFS query to pull information on
I have an Excel spreadsheet that needs to display data from our SQL database.
I have a spreadsheet which we use to log our work. I have read
I have an Excel spreadsheet which is being used to specify filesystem build information
Like many, I have spreadsheet that draws data from over 40 text files as
I have a spreadsheet of data I am parsing using openpyxl's iter_rows function. However
I have a spreadsheet that I am sorting based on an item number column.
I have a spreadsheet I'm using to compile text that changes all the time.

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.