Results 1 to 5 of 5

Record an ever changing cells value from Sheet 1 every 30 seconds into Sheet 2

Threaded View

  1. #4
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Record an ever changing cells value from Sheet 1 every 30 seconds into Sheet 2

    First of all, I must apologize as there is a problem witht he first macro I published. Here a modified macro that works well:
    Public Sub test()
    Dim Start As Variant, asd As Integer
    Start = Timer
    asd = 1
    Do Until Sheets("Sheet1").Range("A1") = "BYE"
    'This is to be able to stop the macro by entering the word BYE inthe cell A1
      Sheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0) = Sheets("Sheet1").Range("A1")
    'Here, it takes the value of cell A1 from Sheet1 (right part of equation)
    'and copy it to the first empty cell in column A of Sheet2.
    'You can change the cell under scope by changing the reference A1 by the cell addrress you want.
    '
    'This loop if there to wait 30 seconds. You can change the 30 to the number you want
      Do Until asd = 0
      asd = Int(Timer - Start) Mod 30
      DoEvents
      Loop
    'This loop is to wait till the end of the 30st second to write the data
    'Otherwise, process is so fast, it would write thousands of duplicates within this second.
      Do Until asd = 1
      asd = Int(Timer - Start) Mod 30
      Loop
    Loop
    End Sub
    I added some comments so you know what a line of program does.
    Look at the attached file for a working workbook.
    Hope this helps
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

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