Hi Thank u for ur reply, still I need some more changes in the code, pls check the attached xl file, it will show step by step what to do.pls make the necessary change in the code for getting the result. Sub CopyColumnsToTableSAS() Dim i As Integer Dim fr As Long Dim lr As Long 'col A Cells(2, 1).Resize(Cells(2, 1).End(xlDown).Row).Copy Cells(2, "g") 'other columns For i = 2 To 5 fr = Cells(2, i).End(xlDown).Row lr = Cells(Rows.Count, i).End(xlUp).Row r = Cells(Rows.Count, i).End(xlUp).Row 'two lines below added. MsgBox fr - 2 Cells(1, i + 6) = fr - 2 '======= Cells(fr, i).Resize(lr).Copy Cells(2, i + 6) Next i End Sub
Regards Rajesh Kainikkara -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com
TallY(3).xlsm
Description: application/vnd.ms-excel.sheet.macroenabled.12