+ Reply to Thread
Results 1 to 12 of 12

dde data copied from sheet1 to sheet2

  1. #1
    Registered User
    Join Date
    08-27-2009
    Location
    Pensacola FL
    MS-Off Ver
    Excel 2003
    Posts
    7

    dde data copied from sheet1 to sheet2

    I am enlcosing a file that I partially acquired (the macro portion) and I am trying to add to that.

    The workbook has a dde link in sheet 1, the macro will write the data to sheet2 at set times. I am creating a report of the data in sheet 2 in sheet3. at this point it is very rudimentary. I need some assistance to clean up the macro and the post of the dat in sheet2. I have created a detailed (probably over detailed) explanantion in sheet 1 in a text box.

    Thanks for any and all assistance given as my programming/excel skills are very limited.

    Thanks
    cb
    Attached Files Attached Files

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: dde data copied from sheet1 to sheet2

    Hello Chuckb74,

    Welcome to the Forum!

    I revised your macro The_Sub. It nows checks if cell "A1" on "Sheet2" has any data. If not, this is first cell the data is pasted into. Otherwise it will use the next empty cell in column "A".
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 08-28-2009 at 04:21 PM.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    08-27-2009
    Location
    Pensacola FL
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: dde data copied from sheet1 to sheet2

    Thanks so much for taking the time out to fix that.

    Will that also fix the overwriting of the entire line instead of just the cell or can that be stopped?

    Thanks
    cb

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: dde data copied from sheet1 to sheet2

    Hello CB,

    It only copies cell "A1" from "Sheet1" over to "Sheet2". The headers in column "B" on are safe.

  5. #5
    Registered User
    Join Date
    08-27-2009
    Location
    Pensacola FL
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: dde data copied from sheet1 to sheet2

    Leith,
    Thanks so much for that. How difficult would it be to write a date/time stamp in the corresponding cell in column b on the data that is being written into sheet2? That would get rid of my labels and it would allow me to double check the time the data is being written into the file.


    Thanks Very much again.

    Sincerely,
    cb

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: dde data copied from sheet1 to sheet2

    Maybe like this:
    Please Login or Register  to view this content.
    Last edited by shg; 08-30-2009 at 08:02 PM.
    Entia non sunt multiplicanda sine necessitate

  7. #7
    Registered User
    Join Date
    08-27-2009
    Location
    Pensacola FL
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: dde data copied from sheet1 to sheet2

    thanks for replying,

    Does that totally replace the sub or is that pasted in at a certain point.

    Thanks and please forgive my ignorance.

    I have totally pasted in Leith's Sub form above and it is working nicely.

    Please let me know and thanks again.
    CB

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: dde data copied from sheet1 to sheet2

    It replaces Leith's code exactly, which has a place (I guess) for you to plug in some of yours.

  9. #9
    Registered User
    Join Date
    08-27-2009
    Location
    Pensacola FL
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: dde data copied from sheet1 to sheet2

    Allow me to answer my own question. I pasted all of it in and replaced what was their and it is working nicely.

    I have another question. Is there any way to know if your macro is running? Is there something I can check some sort of status? My reason for asking is I am now opening up the time to 30 minutes between the macro firing and posting the information to sheet, so I would like to be able to check and know that macro was running, possibly via a countdown feature showing the time until the next posting?

    One more question, remember I am a neophyte..... There are three parts to this macro Start Timer, Stop Timer and The Sub. I noticed that When I Alt-F8 and highlight the Sub and choose run it obviously fires the macro and logs the data to sheet2, well does this automatically start the timer? Or is it just a preliminary logging of the data and the timer just keeps running. I know I am starting to ramble and I apologize. I guess my question is what actually starts the macro running and how can I know where I am in the timing of the macro.

    Update 8-31-09 I am running the macro in the workbook this morning and it appears that my questions above are my overriding concerns, macro running status and on/off of the macro itself? Another question is can the macro be running in multiple instances, i.e. this morning the second 30 minute logging of data into sheet 2 occurred 3 times within the same minute.

    So the good news is it is working it just needs some tweeking and I obvioulsy need to understand macros at a higher level.

    Thanks all
    CB
    Last edited by chuckb74; 08-31-2009 at 10:46 AM.

  10. #10
    Registered User
    Join Date
    08-27-2009
    Location
    Pensacola FL
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: dde data copied from sheet1 to sheet2

    Alright I am going to upload my latest version.

    I have been running it tonight using the futures dde feed and the firing of the macro is happening at slightly random times and I do not know how to trouble shoot it.

    If you look at sheet 2 It should have had postings every 30 minutes starting at 21:03. Instead of 21:33 there were postings @ 21:34 and 21:35. Kinda random, Any help would be appreciated.

    Thanks
    cb
    Attached Files Attached Files

  11. #11
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: dde data copied from sheet1 to sheet2

    Hello chuckb74,

    The problem is the procedure StartTimer is being called again in The_Sub. Remove the StartTimer statement and it should work fine. StartTimer setups up the timer to automatically call The_Sub every thirty minutes. Once the timer is intialized and started, it will run at the assigned interval until you stop it.
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    08-27-2009
    Location
    Pensacola FL
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: dde data copied from sheet1 to sheet2

    Another Macro related question.

    When Load the workbook I get a security alert about the macro's and the links I have been just enabling both of the settings. Well now all of the sudden EXCEL is locking up when I enable both the links and the macros? Any suggestions?
    Thanks
    Last edited by chuckb74; 09-02-2009 at 07:06 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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