Forum Discussion

anwarsafian's avatar
anwarsafian
Copper Contributor
Sep 21, 2024

Macro drag raw until n raw

Hi expert

 

How could I use macro to drag the cell B2 to n raw as shown in attachment?

n raw is based on A column.

If have column A has 11 raw then drag cell B2 formula to B11

If have column A has 101 raw then drag cell B2 formula to B101

  • anwarsafian 

    Here you go:

    Sub CopyCell()
        Dim m As Long
        Application.ScreenUpdating = False
        m = Range("A" & Rows.Count).End(xlUp).Row
        Range("B2:B" & m).FillDown
        Application.ScreenUpdating = True
    End Sub

Resources