VBA01 Copy Resize Variably Sized Ranges

 Copy Resize Variably Sized Ranges


Public Sub CopyResizeVariablySizedRanges()

    'COPY RANGE FOR VARIABLE SIZED RANGES
    Range("A4").CurrentRegion.Copy Range("J4")
    
    'OR FIXED RANGE
    Range("A4:E10").Copy Range("J4")
    
    'PASTESPECIAL METHOD TO USE EXCELS PASTESPECIAL OPTIONS
    
    Range("A4").CurrentRegion.Copy
    Range("J20").PasteSpecial xlPasteValuesAndNumberFormats
    
    
    'TO ADD MORE PASTE SPECIAL OPTION TO ADD A NEW LINE
    Range("J20").PasteSpecial xlPasteComments
    
    'USE THE RESIZE PROPERTY TO RETURN A CHANGED RANGE
    Range("A4").CurrentRegion.Offset(1, 0).Resize(Range("A4").CurrentRegion.Rows.Count - 1).Copy Range("A20")
    
    
    

End Sub



Comments

Popular posts from this blog

VBA MOD01 Passing Arguments to sub procedures (ByRef , By Val)

PY MOD01 Lecture 01