Forum Discussion

Peru99's avatar
Peru99
Copper Contributor
Apr 03, 2022

macro anywhere in workbook

I need to use a macro anywhere in the worksheet to enter the numbers 1 to 48 but every time I run mine it returns to the same cells.

 

2 Replies

  • Peru99 

    Does this do what you want?

    Sub Test()
        Dim i As Long
        Application.ScreenUpdating = False
        For i = 1 To 48
            ActiveCell.Offset(i - 1).Value = i
        Next i
        Application.ScreenUpdating = True
    End Sub
    • Peru99's avatar
      Peru99
      Copper Contributor
      Sorry to be so late back I have been suffering with Covid. That is great thanks it works like a dream, very grateful