Divad
09-26-2007, 07:14 AM
Firstly, i have a macro that copies data from 2 worksheets. i do this everyday and the worksheet names are always the same. Rather than writing the macro twice is there a loop or something that i can specify the worksheet names in?
Sheets("Sheet2").Select
Dim lastRow
Range("A65536").Select
Selection.End(xlUp).Select
lastRow = ActiveCell.Row
Range(Cells(2, 1), Cells(lastRow, 17)).Copy
Sheets("Sheet1").Select
Range("A65536").Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Sheets("Sheet3").Select
Range("A65536").Select
Selection.End(xlUp).Select
lastRow = ActiveCell.Row
Range(Cells(2, 1), Cells(lastRow, 17)).Copy
Sheets("Sheet1").Select
Range("A65536").Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Secondly, i also open an excel worksheet from a link in Internet Explorer (file name is always the same). Is there a macro that i can write to copy data from it as it opens in Internet Explorer?
Thanks
Sheets("Sheet2").Select
Dim lastRow
Range("A65536").Select
Selection.End(xlUp).Select
lastRow = ActiveCell.Row
Range(Cells(2, 1), Cells(lastRow, 17)).Copy
Sheets("Sheet1").Select
Range("A65536").Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Sheets("Sheet3").Select
Range("A65536").Select
Selection.End(xlUp).Select
lastRow = ActiveCell.Row
Range(Cells(2, 1), Cells(lastRow, 17)).Copy
Sheets("Sheet1").Select
Range("A65536").Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Secondly, i also open an excel worksheet from a link in Internet Explorer (file name is always the same). Is there a macro that i can write to copy data from it as it opens in Internet Explorer?
Thanks