Force “F2”+“Enter” on range of cells

后端 未结 12 1818
伪装坚强ぢ
伪装坚强ぢ 2021-01-04 05:31

I have an Excel 2010 worksheet which has macros to copy data from other sheets into a specific format on another sheet.

The data copies but I have an issue with the

12条回答
  •  误落风尘
    2021-01-04 05:44

    This worked for me.

    Dim r As Range
    Dim n As Integer
    Dim AssDateLastRow As Long
    
    AssDateLastRow = ActiveSheet.Range("E" & Rows.Count).End(xlUp).Row
    
    Set r = Range("E2:E" & AssDateLastRow)
    r.Select
    r.NumberFormat = "ddmmyyyy;@"
    r.Select
    For n = 1 To r.Rows.Count
        SendKeys "{F2}", True
        SendKeys "{ENTER}", True
    Next n
    

提交回复
热议问题