且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

需要帮助来完成VBA

更新时间:2023-11-25 17:31:16

也发布在
https:// answers。 microsoft.com/en-us/msoffice/forum/msoffice_excel-msoffice_custom-mso_2016/help-with-additional-info-for-vba/f2b64064-dbe5-4074-b050-7589e62085e6

Hi,

     I am currently using this formula for showing data every minute:

Private Sub Worksheet_change(ByVal Target As Range)
   If Target.Address = "$A$1" Then
      With ThisWorkbook.Names("listdde").RefersToRange.CurrentRegion
         With .Offset(.Rows.Count, 0).Resize(1, 1)
             .Value = Now
             .Offset(0, 1).Value = Target.Value
          End With
      End With
   End If
End Sub

 How do I get this macro to return to the initial cell (B2) when it reaches 24 hours (b1441), so it loops?

 On top of that I would like that as a cell is filled I would like that the fifth cell in front of it is cleared, as this would otherwise affect my other formulas.

For example when b2 gives a reading, B7 is then wiped. B3 gives a reading, B8 is wiped. Also when B1437 gives a reading then B2 would be wiped.

Help would be very much appreciated

Thanks

Also posted in https://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel-msoffice_custom-mso_2016/help-with-additional-info-for-vba/f2b64064-dbe5-4074-b050-7589e62085e6