Hi there, I need your help for python <--> excel. I want to paste selected cells (range) to different location on the same sheet in Excel through python. I have tried it for a while but could not figure it out. Here is my sample code:
import win32com.client xl=win32com.client.Dispatch("Excel.Application") xl.Visible=1 wb = xl.Workbooks.Add( ) sh=wb.Worksheets(1) sh.Cells(1,1).Value = "Hello World!" sh.Cells(3,3).Value = "Hello World!" sh.Range(sh.Cells(1,1),sh.Cells(3,3)).Select() sh.Range(sh.Cells(1,1),sh.Cells(3,3)).Copy() # sh.Range(sh.Cells(4,1),sh.Cells(6,3)).Paste() The last line of the code does not work. Thanks you very much. Ouyang -- http://mail.python.org/mailman/listinfo/python-list