Results 1 to 5 of 5

Thread: Activity Based Depreciation If /Then VBA Code

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    Thanks mrmmickle for sharing this.

    For the Sub EnterData_Click, you could write it this way

    Code:
    Private Sub EnterData_Click()    
        Dim ws As Worksheet
        Set ws = Worksheets(2)
    
    
       'Insert Year Headers
       ws.Cells(14, 3).Resize(6).Formula = "=IF(D14="""", """", ""Year ""&ROW()-13)"
       
       'Insert Hourly Rate
       ws.Cells(14, 5).Resize(6).Formula = "=$D$10"
       
       'Insert Depreciation Rate
       ws.Cells(14, 6).Resize(6).Formula = "=D14*E14"
       
       'Insert Accumulated Depreciation
       ws.Cells(14, 7).Resize(2).Formula = "=$F$14"
       ws.Cells(16, 7).Resize(4).Formula = "=G15+F16"
       
       'New Value
       ws.Cells(14, 8).Resize(2).Formula = "=$D$5-F14"
       ws.Cells(16, 8).Resize(4).Formula = "=H15-F16"
       
    End Sub
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  2. #2
    Member mrmmickle1's Avatar
    Join Date
    Sep 2012
    Posts
    51
    Rep Power
    14
    ExcelFox,

    Thank you for the tip. I see how much easier this is and less typing!! I appreciate you following up on my post!
    Using Excel 2010

Similar Threads

  1. Projected Depreciation in Excel
    By Suhail in forum Excel Help
    Replies: 7
    Last Post: 01-04-2014, 01:51 AM
  2. Replies: 17
    Last Post: 05-22-2013, 11:58 PM
  3. VBA and Depreciation
    By Whitley in forum Excel Help
    Replies: 0
    Last Post: 03-16-2013, 01:32 AM
  4. How to track user activity using a macro?
    By Rajesh Kr Joshi in forum Excel Help
    Replies: 4
    Last Post: 08-10-2012, 06:50 PM
  5. Visual Plotter basis given dates and activity
    By Rajesh Kr Joshi in forum Excel Help
    Replies: 2
    Last Post: 03-07-2012, 02:37 PM

Posting Permissions

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