【问题标题】:Print the next month [duplicate]打印下个月[重复]
【发布时间】:2019-10-16 02:45:11
【问题描述】:

我希望 excel 在下一行打印下个月的日期。 (第三排有柜台)

例如:

B28 = 01.07.2019 
C24 = 01.06.2019  
D16 = 01.02.2019 
E19 = 01.07.2019

截图如下:https://ibb.co/d0mW8GB

【问题讨论】:

    标签: excel vba excel-2010


    【解决方案1】:

    您的问题有很多缺失的部分,但我尝试创建一个代码来满足您的需求。你可以试试:

    Option Explicit
    
    Sub makro3()
    
        Dim LastColumn As Long, LastRow As Long, Column As Long, Row As Long, Paid As Long
    
        'In your quetion there is no starting date so i use the current one
    
        With ThisWorkbook.Sheets("Sheet1")
    
            LastColumn = .Cells(3, .Columns.Count).End(xlToLeft).Column
    
            For Column = 2 To LastColumn
    
                Paid = .Cells(3, Column).Value
    
                For Row = 1 To Paid
    
                    LastRow = .Cells(.Rows.Count, Column).End(xlUp).Row
    
                    .Cells(LastRow + 1, Column).Value = DateAdd("m", Row, Date)
    
                Next Row
    
            Next Column
    
        End With
    
    End Sub
    

    结果:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-01
      • 1970-01-01
      • 2020-10-01
      • 1970-01-01
      • 2012-05-28
      • 1970-01-01
      • 2018-05-16
      • 1970-01-01
      相关资源
      最近更新 更多