Run a vba Sub routine every xx seconds

kennimack

New Member
Joined
Apr 19, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hopefully someone can help me with this one.

I have a spreadsheet that we use a VBA userform to input and update the data.
column "a" of the worksheet is named SLNUM, and the entries here mirror the excel row numbers.
when the form loads, it displays the next (blank) available number, and this is displayed in a textbox on the userform.

I have created a button which runs the following code to update the textbox, SLNRESET is the button name

' reset SL number
Private Sub SLNRESET_Click()

With slnum
.Value = Format(Val(Range("A" & Rows.Count).End(xlUp)) + 1, "00000")
.Enabled = True
End With
end Sub

Is there any way to make this code run every 30 seconds, as when users forget to click the button they can create duplicate line numbers.

I've included the top of the form for reference.

Thanks
 

Attachments

  • Presentation1.jpg
    Presentation1.jpg
    95.4 KB · Views: 21

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,223,903
Messages
6,175,279
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top