can someone help me, i try to write a code with 2 file open ABC.xlsm and KM.xlsm .Thisworkbook is ABC.xlsm
sub copy()
Dim sh As Workbook
Dim tensheet As String
Set sh = Workbooks("KM.xlsm")
tensheet = Range("O2").Value
sh.Sheets.Add(After:=Sheets(Sheets.Count)).Name = tensheet
end sub
i get this error "runtime error 1004 application-defined or object-defined error" this code will run if i add "sh.active" before add a new sheet but i dont want to. Any help?