Forum Discussion

hrh_dash's avatar
hrh_dash
Iron Contributor
Sep 07, 2022
Solved

Macro to input values for lastcol with regards to a specific row

Would like to seek advise for a macro to input values in the next column of lastcol; ie lastcol.offset(0, 1).   For example if there is a value in A1, when the macro executed, the value will be pop...
  • Harun24HR's avatar
    Sep 07, 2022

    hrh_dash If you want to add data to right after last column of a specific row then try-

    Sub AddToLastCol()
    Dim lastCol As Long
    Dim ws As Worksheet
    
        Set ws = Sheet4
        lastCol = ws.Cells(1, Columns.Count).End(xlToLeft).Column + 1
        ws.Cells(1, lastCol) = "Yes"
    
    End Sub