![]() |
vb code to copy and list selected row to diff sheets
I am working with workbook with 30sheets for each day x each worksheet having
same headers and colmuns x I want to copy selected rows to corresponding sheets with different name . eg. date name details amount type 13feb kk ccj/dxb 1300 inv 14feb pv ccj/auh 1200 alh I would like to copy first row to a sheet named inv and second row to sheet names alh. can u adv me the code to be used -- pvkkutty new to discussion group however a freequent reader of discussion group posts |
vb code to copy and list selected row to diff sheets
Try the below code with all the sheets...
Sub CopyRowstoDifferentSheets() Dim wb As Workbook, ws1 As Worksheet, ws2 As Worksheet Dim lngRow As Long, lngLastRow1 As Long, lngLastRow2 As Long Set wb = ActiveWorkbook: Set ws1 = wb.ActiveSheet lngLastRow1 = ws1.Cells(Rows.Count, "E").End(xlUp).Row For lngRow = 2 To lngLastRow1 Set ws2 = wb.Sheets(CStr(ws1.Range("E" & lngRow))) lngLastRow2 = ws2.Cells(Rows.Count, "E").End(xlUp).Row ws1.Rows(lngRow).Copy ws2.Rows(lngLastRow2 + 1) Next End Sub -- Jacob "pvkutty" wrote: I am working with workbook with 30sheets for each day x each worksheet having same headers and colmuns x I want to copy selected rows to corresponding sheets with different name . eg. date name details amount type 13feb kk ccj/dxb 1300 inv 14feb pv ccj/auh 1200 alh I would like to copy first row to a sheet named inv and second row to sheet names alh. can u adv me the code to be used -- pvkkutty new to discussion group however a freequent reader of discussion group posts |
All times are GMT +1. The time now is 12:13 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com