+ Reply to Thread
Results 1 to 7 of 7

increment cells by 10 on a daily basis. regardless of what number is entered into the cell

Hybrid View

  1. #1
    Registered User
    Join Date
    12-20-2012
    Location
    uk
    MS-Off Ver
    Excel mac
    Posts
    36

    increment cells by 10 on a daily basis. regardless of what number is entered into the cell

    Workbook1.xlsx

    how do increment the hours by 10 hours on a daily basis.
    Also would it be possible to have a caption box in which i can change the increment value. so if i wanted the increment to be 11 i would change the value in the caption box to 11.
    I know i need a macro to do this but i just can't figure it out.

    Thanks in advance.

  2. #2
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: increment cells by 10 on a daily basis. regardless of what number is entered into the

    Can I clarify that on each new day, Cells D3:D22 increase by 10 (increment value)?

  3. #3
    Registered User
    Join Date
    12-20-2012
    Location
    uk
    MS-Off Ver
    Excel mac
    Posts
    36

    Re: increment cells by 10 on a daily basis. regardless of what number is entered into the

    yes thats correct

  4. #4
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: increment cells by 10 on a daily basis. regardless of what number is entered into the

    Here is what I have come up with...

    Workbook1 (1).xlsm

    I have had to put a cell in which will keep track of when it was last updated as I am unsure if there is a way to store that in the code to be honest!

    Hope it will do the job!

    ARowbot

  5. #5
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: increment cells by 10 on a daily basis. regardless of what number is entered into the

    Slight Improvement: No longer needs Increment Value cell
    Workbook1 (1).xlsm

    Private Sub Workbook_Open()
    
    Dim IncrementValue As Variant
    
    IncrementValue = InputBox("Increment hours by:", "Increment Value", 10)
    
    For r = 3 To 22
    If Date > Cells(1, 2).Value Then
    Cells(r, 4).Value = Cells(r, 4).Value + IncrementValue
    End If
    Next r
    
    Cells(1, 2).Value = Date
    
    End Sub
    Last edited by ARowbot; 03-28-2015 at 11:18 AM.

  6. #6
    Registered User
    Join Date
    12-20-2012
    Location
    uk
    MS-Off Ver
    Excel mac
    Posts
    36

    Re: increment cells by 10 on a daily basis. regardless of what number is entered into the

    thats works excellent. just exactly what i was looking. silly question alert...... what does the r stand for and if i wanted to duplicate this 2 more times on the same sheet how would it affect me? so that all the hours cells updated by the same.
    as shown in the sheet.
    thanks a lot in advance.
    Gary
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: increment cells by 10 on a daily basis. regardless of what number is entered into the

    r is just a variable that it uses (in this case runs through the rows)
    For r = 3 to 22
    means that it will use r = 3 first, run the script until
    next r
    then it will come back and use r = 4 etc..

    To duplicate it for the next columns you could use

    Private Sub Workbook_Open()
    
    Dim IncrementValue As Variant
    
    IncrementValue = InputBox("Increment hours by:", "Increment Value", 10)
    
    For r = 3 To 22
    If Date > Cells(1, 2).Value Then
    Cells(r, 4).Value = Cells(r, 4).Value + IncrementValue
    Cells(r, 6).Value = Cells(r, 6).Value + IncrementValue
    Cells(r, 8).Value = Cells(r, 8).Value + IncrementValue
    End If
    Next r
    
    Cells(1, 2).Value = Date
    
    
    
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Cell color has to change for all updated cells on daily basis
    By ajaypal.sp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-04-2015, 11:05 AM
  2. Replies: 4
    Last Post: 06-01-2014, 04:54 AM
  3. Replies: 3
    Last Post: 09-04-2013, 01:56 AM
  4. Replies: 1
    Last Post: 04-18-2013, 02:51 PM
  5. Need to sum number of error by weekly and daily basis
    By marc5354 in forum Excel General
    Replies: 2
    Last Post: 11-03-2010, 11:04 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1