Forum Discussion

Chandrakanth K's avatar
Chandrakanth K
Copper Contributor
Dec 27, 2018

How to paste till last row using Macro

Hello Team,

 

I have two columns "System" and "CC". I need to past dolphin after the last row till i have values in "CC".

How do i code this. when i record i am getting a range but range always changes. Need help

 

Attached Macro File.

 

Regards,

Chandrakanth.K

  •  

    How about the below?     Cells(Rows.Count, 2).End(xlUp).Row     finds the last used row in Column 2. 

     

     

    Sub FillDolphin()

    Dim lRow As Long

    lRow = Cells(Rows.Count, 2).End(xlUp).Row

    Range("A4:A" & lRow).Formula = "Dolphin"

    End Sub

     

  • JWR1138's avatar
    JWR1138
    Iron Contributor

     

    How about the below?     Cells(Rows.Count, 2).End(xlUp).Row     finds the last used row in Column 2. 

     

     

    Sub FillDolphin()

    Dim lRow As Long

    lRow = Cells(Rows.Count, 2).End(xlUp).Row

    Range("A4:A" & lRow).Formula = "Dolphin"

    End Sub

     

Resources