Consulting

Results 1 to 3 of 3

Thread: If E and F is empy paste to column

  1. #1
    VBAX Mentor
    Joined
    Feb 2012
    Posts
    406
    Location

    If E and F is empy paste to column

    Hello This is my code that will check column M and if it is empty will copy column L to Column E and Column K to Column F and now i want to add check column E and F and if they are empty do the paste .
    Hope you can help me on this subject .
    Thanks for your help and time.
    Sub Clear()
        Dim r As Range
        For Each r In Intersect(Range("M:M"), ActiveSheet.UsedRange)
            If IsEmpty(r) Then
                r.Offset(, -1).Resize(, 1).Copy r.Offset(, -8)
                r.Offset(, -2).Resize(, 1).Copy r.Offset(, -7)
            End If
        Next
    End Sub

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Is this what you want?

    Sub Clear()
        Dim r As Range
        For Each r In Intersect(Range("M:M"), ActiveSheet.UsedRange)
            
            If IsEmpty(r) And IsEmpty(Cells(r.Row, "E")) And IsEmpty(Cells(r.Row, "F")) Then
            
                r.Offset(, -1).Resize(, 1).Copy r.Offset(, -8)
                r.Offset(, -2).Resize(, 1).Copy r.Offset(, -7)
            End If
        Next
    End Sub
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Mentor
    Joined
    Feb 2012
    Posts
    406
    Location
    Thank you so much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •