Results 1 to 7 of 7

Macro Solving One Line At A Time

Threaded View

  1. #1
    Registered User
    Join Date
    11-21-2022
    Location
    United States
    MS-Off Ver
    2022
    Posts
    4

    Macro Solving One Line At A Time

    I have the following macro, that I need to add a certain value "R9" to a list of cells "D14:D21"

    The problem is the cell "R9" is a variable and decreases after every occurrence, because increasing the value of "D14", decreases "R9".

    How do I get excel to add the value of "R9" to all the cells before "R9" decreases?

    I have also attached the excel sheet with the cells and macro.


    Sub BonusLap()
    '
    ' BonusLap Macro
    '
    ' Keyboard Shortcut: Ctrl+Shift+L


    Range("D14").Value = Range("D14").Value + Range("R9").Value
    Range("D15").Value = Range("D15").Value + Range("R9").Value
    Range("D16").Value = Range("D16").Value + Range("R9").Value
    Range("D17").Value = Range("D17").Value + Range("R9").Value
    Range("D18").Value = Range("D18").Value + Range("R9").Value
    Range("D19").Value = Range("D19").Value + Range("R9").Value
    Range("D20").Value = Range("D20").Value + Range("R9").Value
    Range("D21").Value = Range("D21").Value + Range("R9").Value

    '
    End Sub



    Thanks,

    Jason
    Attached Files Attached Files
    Last edited by kunjason; 11-21-2022 at 03:48 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] I'm getting Run-time error ‘13’: type mismatch and unsure about solving.
    By sdingman in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-10-2020, 03:34 AM
  2. Solving for OT after certain hours in a time-card
    By Bundok@mac.com in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-20-2018, 05:50 AM
  3. Replies: 9
    Last Post: 07-17-2014, 11:48 AM
  4. [SOLVED] Solving a time problem with conditional formatting
    By smig123 in forum Excel General
    Replies: 4
    Last Post: 02-03-2014, 10:59 AM
  5. Replies: 3
    Last Post: 06-10-2012, 11:02 AM
  6. Replies: 3
    Last Post: 01-12-2012, 02:24 PM
  7. Time Line Macro
    By E3iron in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-29-2009, 03:39 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