Sunday, 15 February 2015

Taking too much time to copy from one excel sheet row (matching rows) to another excel sheet - VBA -


I am using this code to click on the command, from one sheet to another in the sheet with some criteria To copy Loads are taking too long to load.

Is this a way to speed up? I'm new to VBA Excel and I'm learning. As long as the last line of lngLastRow long dim strValue string dim lngRowOutput as long dim lngRow content Master Data lngLastRow = Longs of sheets 'getting' (2). Used range Line 'Message' message box lngLastRow application. Clear the row from the line 'ScreenUpdating = False' row 2. Sheet for column 1 column header (6) .Range ("2: 1,048,570"). Clear 'Mm decisive turning sheet lngRowOutput = 2' where we are going to lngRow to write values ​​to Sheet2 = lngLastRow strValue = Sheets for 2 = (2) .cs (lngRow, 5) .Value 'Column D' is being used for special lessons in the transaction. InStr (1, strValue, vbTextCompare) & gt; Specified in table "if; 0 Sheets (2) .ows (lngRow) .Copy Sheet (6) .owsows (lngRowOutput) .PasteSpecial lngRowOutput = lngRowOutput +1 or 'MsgBox Sheet (3) .owsows (lngRow) .Copy end then the next lngRow application.ScreenUpdating = True worksheet (6) .Activate worksheet (6) .Visible = true worksheet (6) .Select end sub

  dim lngLastRow as long as dim lngRow retarded as long String thum lngRowOutput content month as strValue Sector long as the last line of data lngLastRow = Sheets (2). Usage Range.Ros.Count 'MSBBX LNG ListsRO Application. Sheet down from the screen updating = Falls' row 2. The row 1 is for column headers. Sheets (6). Ranges ("2: 1048570"). Clear 'MM Criticality Sheet LNGRO Output = 2' Where is where we write values ​​in Sheet 2 lngLastRow strValue = Sheets (2) for lngRow = 2 .seel (LNGRO, 5) .Value 'value from column D 'Doing for special lessons in the transaction. InStr (1, strValue, vbTextCompare) & gt; if specified in "table"; 0 sheets (6) .ro (lngRowOutput) = sheets (2) .DO (lngRow). Value lngRowOutput = lngRowOutput + 1 other 'MSBBC Sheets (3) .DO (LNGRO). Copy and if next lngRow application.ScreenUpdating = True Worksheets (6). Activate worksheets (6) .Vibil = True worksheets (6). Choose end  

No comments:

Post a Comment