+ Reply to Thread
Results 1 to 3 of 3

how to not repeat code

  1. #1
    Registered User
    Join Date
    10-17-2015
    Location
    USA
    MS-Off Ver
    2013
    Posts
    1

    Lightbulb how to not repeat code

    I am making a time sheet to track hours for my workers. I am using an active x check box to deducted lunch breaks when they are taken and not deduct when they are not. Below is the code I am using. It is working fine but I know there is an easier way. Could someone please help me out here. Thank you in advance.

    Please Login or Register  to view this content.
    Last edited by Brettwvu; 10-17-2015 at 08:57 PM. Reason: code tags added

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2507 Win 11
    Posts
    24,917

    Re: how to not repeat code

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (Because you are new to the forum, I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,658

    Re: how to not repeat code

    If you set the Checkbox's Linked Cell property to a cell (K164 for this example), you could calculate with just a formula. No VBA needed.

    =(H164-I164) *-24 -(0.5*K164)
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

+ 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. Repeat code in the same sheet for a different list
    By pkellogg in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-08-2015, 09:25 AM
  2. Trying to Repeat an If, Than, ElseIf code
    By KAGM in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-23-2013, 10:37 AM
  3. [SOLVED] vba code to find repeat rows
    By dimvelements13579 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-12-2012, 07:40 AM
  4. VBA code to repeat steps in Macro
    By kenadams378 in forum Excel Programming / VBA / Macros
    Replies: 50
    Last Post: 08-22-2012, 09:44 AM
  5. Repeat a portion of code
    By silverxx12 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-06-2012, 09:42 AM
  6. Macro Code Only Pastes Once Need to repeat
    By realniceguy5000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-25-2008, 03:34 PM
  7. Repeat code over 300 rows
    By Patrick Simonds in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-24-2005, 12:15 PM

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