+ Reply to Thread
Results 1 to 19 of 19

Macro for copying the value of one Cell to another cell(s) in specific time interval

  1. #1
    Registered User
    Join Date
    07-15-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    17

    Macro for copying the value of one Cell to another cell(s) in specific time interval

    Hi, I am new to this Forum and also in writing Macros.

    So, I have managed to write this Macro to copy the value of J2 to K2 and subsequently to L2..M2..N2... where the updated value of J2 is being recorded in subsequent cells at 1 minute's interval.

    Please Login or Register  to view this content.

    My question is, how do I now modify this Macro to also copy the values of J3 to K3..L3..M3..N3.. and J4 to K4..L4..M4..N4... upto J218 to K218..L218..M218..N218... ?

    Thanks.
    Last edited by Swarnendu; 07-15-2017 at 03:55 PM.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro for copying the value of one Cell to another cell(s) in specific time interval

    Maybe:

    Please Login or Register  to view this content.
    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.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    07-15-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    17

    Re: Macro for copying the value of one Cell to another cell(s) in specific time interval

    Thanks a ton!! it works perfectly!!

    Now, how can I program this Macro to start a 9.00 AM and stop at 3.30 PM everyday from Monday to Friday?

    Thanks once again..
    Last edited by Swarnendu; 07-16-2017 at 05:30 AM.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro for copying the value of one Cell to another cell(s) in specific time interval

    You're welcome and thanks for the rep!

    I'll have to research your question as I don't know offhand

  5. #5
    Registered User
    Join Date
    07-15-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    17

    Re: Macro for copying the value of one Cell to another cell(s) in specific time interval

    OK, I'll be waiting.....

  6. #6
    Registered User
    Join Date
    07-15-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    17

    Re: Macro for copying the value of one Cell to another cell(s) in specific time interval

    Hi again..

    I think I have managed to write the code for starting the macro at 9AM

    I have written this on Thisworkbook:

    Please Login or Register  to view this content.
    And, this works!!

    Now, how to stop the Macro at 3.30PM?
    If I replace the last line of my "MntCalculate" Macro with

    Please Login or Register  to view this content.
    will it work?

    And, how to NOT run the Macro on Saturdays & Sundays??
    And, How to automatically open this workbook at 9AM???

    Thanks,

    Swarnendu
    Last edited by Swarnendu; 07-15-2017 at 05:22 PM.

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro for copying the value of one Cell to another cell(s) in specific time interval

    I'm Guessing:

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    07-15-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    17

    Re: Macro for copying the value of one Cell to another cell(s) in specific time interval

    OK, I'll give it a try and come back tomorrow with the result.

    Thanks again!!


    Swarnendu

  9. #9
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro for copying the value of one Cell to another cell(s) in specific time interval

    You're welcome again Hope it works.

  10. #10
    Registered User
    Join Date
    07-15-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    17

    Re: Macro for copying the value of one Cell to another cell(s) in specific time interval

    OT:

    ("You must spread some Reputation around before giving it to xladept again."

    I understand why it is necessary. But, what if I find no one else to "spread some Reputation around"? )

    Back to Topic:

    It seems that the latest Macro is working. I'll have to observe a whole week and a day more to be certain though. Meanwhile, I have used the Task Scheduler to OPEN the Worksheet at 9 AM (the one I thought would be the toughest eventually came out to be the easiest,though for now it will run on Saturdays & Sundays also, but I think I will be able to find a solution to that myself)

    Thank you xladept for all your help. This is the first time I have tried my hand on writing VBA codes. But, I am certain this will NOT be my last. It's people like you who inspire people like me to always try new things in life.

    BTW, if you ever need ANY suggestion about anything concerning dogs, you can always mail me at [email protected]


    Swarnendu

  11. #11
    Registered User
    Join Date
    07-15-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    17

    Re: Macro for copying the value of one Cell to another cell(s) in specific time interval

    Ok, now I am getting an error in the line after "Else", "Ontime" is being highlighted..

    Please Login or Register  to view this content.
    Swarnendu

  12. #12
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro for copying the value of one Cell to another cell(s) in specific time interval

    Please Login or Register  to view this content.
    * There may have been an extra comma in the code

  13. #13
    Registered User
    Join Date
    07-15-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    17

    Re: Macro for copying the value of one Cell to another cell(s) in specific time interval

    Now there is a "Runtime error '1004'. Method 'Ontime' of object '_Aplication' failed"

  14. #14
    Registered User
    Join Date
    07-15-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    17

    Re: Macro for copying the value of one Cell to another cell(s) in specific time interval

    What if I remove the condition "Else"? My program will run from Monday to Friday, what will happen on Saturdays and Sundays?

    FYI, I initially missed the Else and subsequent two lines when I wrote it after your previous post, and there was no errormessage.

  15. #15
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro for copying the value of one Cell to another cell(s) in specific time interval

    From what I've read, we need to find a way to stop it.

  16. #16
    Registered User
    Join Date
    07-15-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    17

    Re: Macro for copying the value of one Cell to another cell(s) in specific time interval

    How about this one? I got it from someone else, who thinks that the Day function is incorrect...

    Please Login or Register  to view this content.

  17. #17
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro for copying the value of one Cell to another cell(s) in specific time interval

    My bad - it should be weekday.

    Maybe:

    Please Login or Register  to view this content.

  18. #18
    Registered User
    Join Date
    07-15-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    17

    Re: Macro for copying the value of one Cell to another cell(s) in specific time interval

    Well, these are my latest Macros, and everything seems to be working fine:

    Workbook:
    Please Login or Register  to view this content.
    Sheet7:
    Please Login or Register  to view this content.
    Thank you xladept for all the help you provided.

    I'll come back to start another thread if I still face any problems with the codes.

    Swarnendu
    Last edited by Swarnendu; 07-19-2017 at 06:42 PM.

  19. #19
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro for copying the value of one Cell to another cell(s) in specific time interval

    Great! Glad you got it working! You're welcome!

+ 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. Replies: 19
    Last Post: 08-18-2021, 11:23 PM
  2. Interval Cell copying
    By jediknight in forum Excel General
    Replies: 2
    Last Post: 02-08-2015, 05:43 PM
  3. [SOLVED] look up cell value in time interval
    By Vestlink in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-22-2014, 03:00 AM
  4. Macro problem - copying specific cell's from one sheet to another
    By Mrgud in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-12-2012, 02:27 PM
  5. delete a specific cell value with interval
    By pani_hcu in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-21-2011, 11:40 PM
  6. Macro for copying specific text from a cell
    By mvel_sky in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-29-2010, 02:47 AM
  7. copying cells at a specific interval
    By scareface in forum Excel General
    Replies: 5
    Last Post: 01-30-2007, 04:43 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