简体   繁体   中英

If with copy paste in last row

In my excel sheet i want to copy the data from last row/same row of column EKM AF AI, if a condition is met in column AF =Concrete and paste it another sheet in different location

Dim FinalRow As Long
LR = lastrow

LR = Worksheets("MASTER LOG-1").Range("AF" & Rows.Count).End(xlUp).Row

If LR = "concrete" Then

Worksheets

Dim FinalRow As Long
LR = lastrow

LR = Worksheets("MASTER LOG-1").Range("AF" & Rows.Count).End(xlUp).Row

If LR = "concrete" Then

Worksheets

if a condition is met in column AF =Concrete then copy data from same row of match in column E,K,M,AF,AI

This should help you well underway.

Sub Copy_Concrete()

    Dim lastr As Integer
    lastr = Worksheets("MASTER LOG-1").Range("AF" & Rows.Count).End(xlUp).Row 'determine last row of column AF
    If Worksheets("MASTER LOG-1").Range("AF" & lastr) = "Concrete" Then 'If lastrow of AF = concrete then
        Worksheets("Some other sheet").Range("Your range").Value = Worksheets("MASTER LOG-1").Range("Whichevercolumn", lastr).Value 'Set whichever range on another sheet to the value on the same row whichever column of your match.
    End If

End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM