Consulting

Results 1 to 8 of 8

Thread: VBA Help, need this for school

  1. #1

    VBA Help, need this for school

    Hi,

    I have problem to get this code to loop, it do copy ones but then stops, Plese Help!


    Dim TimeToRun
    Sub auto_open()
    Call ScheduleCopyPriceOver
    End Sub
    
    Sub ScheduleCopyPriceOver()
    TimeToRun = Now + TimeValue("00:00:01")
    Application.OnTime TimeToRun, "CopyPriceOver"
    End Sub
    
    Sub CopyPriceOver()
    Set mycell = Cells(65000, 3).End(xlUp).Offset(1, 0)
    mycell.Value = Now
    mycell.Offset(0, 1).Value = Range("D7").Value
    Call ScheduleCopyPriceOver
    End Sub
    
    Sub auto_close()
    On Error Resume Next
    Application.OnTime TimeToRun, "CopyPriceOver", , False
    End Sub

  2. #2
    What exactly do you want the subroutine to do? I don't think it's necessary to have several subroutines like you currently have.
    What do you want the end result to look like?

    Can you provide any examples.

  3. #3
    Hi,

    I whant to copy one cell so that i get the current shareprice every minut (in the code is it every sec but that is just for testing)

    Skärmavbild 2014-10-21 kl. 11.03.52.jpg

  4. #4
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    an assignment?
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  5. #5
    Hi

    I need to get down the data to calculate how share prices moves over time. The only data i can get is daly but i need it to be on a shorter time frame.

    But the scirpt stops after copy one cell. Then i need to start it agian.
    I really need som help

    Thanks in advance

  6. #6
    Hi,

    I have solved it

    Thx for the help

  7. #7
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Greetings bombaybom,


    Thank you for being forthright in stating that this is for a school assignment.

    Although giving you a solution forthwith would seem counter productive for your true education, I would suggest including a workbook attached. This way, you can better explain the problem, and we can, without giving an 'answer', guide you to discovering the answer for your assignment. In short - at least as far as I am concerned - you should be able to advise your teacher of this thread and be able to receive full credit for your developed solution. Does that make sense?

    Mark

  8. #8
    HI Mark,

    I understand that just give the right answer wood be counter produktive but somtimes you jsut need som guidens.

    The school assignment was not to use VBA. It was to calculate equity prices. I just thought VBA was the best way to solve it.
    Now I try to get my web queries to work. To bring it all together.

    Chris

Tags for this Thread

Posting Permissions

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