• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

more efficient macro visble cells from one sheet to another

RAM72

Member
Hi All

Have recorded macro from but requires to copy non contigous columns with visible cells only to another sheet still to end of data

Looking for a better and efficient code

Copy visble cells O and P , S and T of of non contigious columns workings and paste visble cells on summary Tariff_1 in continious columns
Take note that data on workings is a summary of subtotals which is in collapse form

Thanks if any one can help

Code:
Range("O1:P1").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.SpecialCells(xlCellTypeVisible).Select
    Selection.Copy
    Sheets("Summary Tariff_1").Select
   
    Range("A1").Select
    ActiveSheet.Paste
    Sheets("Workings").Select
    Range("S1:T1").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.SpecialCells(xlCellTypeVisible).Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Summary Tariff_1").Select
    Range("C1").Select
    ActiveSheet.Paste
End Sub

summary tariff expected tariff.jpg Workings sheet.jpg
 
Something like this?
Code:
Sub Test()
With Union(Range("O:P"), Range("S:T"))
    .SpecialCells(xlCellTypeVisible).Copy Sheets("Summary Tariff_1").Range("A1")
End With
End Sub

Run the code while Workings sheet is active.
 
Back
Top