i want open particular file , copy cells file , paste in active workbook, getting error '438': object doesn't support property or method.
here code:
sub open_file() dim open_book variant com_name = inputbox("enter company ticker", "enter company ticker") if (isempty(com_name)) msg = msgbox("please, enter company ticker", vbcritical) else open_book = workbooks.open("e:\mutual fund\data\nifty 50\" & com_name & ".xlsx") windows(com_name & ".xlsx").activate range("a:a,h:h").select selction.copy windows("try.xlsm").activate range("a1").select selection.paste end if end sub
try below code
sub open_file() dim open_book variant com_name = inputbox("enter company ticker", "enter company ticker") if (isempty(com_name)) msg = msgbox("please, enter company ticker", vbcritical) else set open_book = workbooks.open("e:\mutual fund\data\nifty 50\" & com_name & ".xlsx") range("a:h").copy windows("try.xlsm").activesheet.range("a1") end if end sub
Comments
Post a Comment