Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default add-ins error + setting workbooks

I have a macro that manipulates the cells from 2
workbooks. It prompts for 2nd file to be open, do some
calculations, and then copy and paste some cells from 2nd
opened workbook to the 1st workbook. This procedure worked
fine when I run it from the .xls file. However, when I
have it as a add-in, this part did not work at all. I
tried debugging it, but it did not seem to recognize the 2
workbook files. My code is as follow:

Filename = Application.GetOpenFilename(FileFilter:=Filt,
Title:=Title)
'Exit if the dialog box canceled, else open file in new
workbook
If Filename = False Then
MsgBox "No file selected."
Exit Sub

Else
Workbooks.Open (Filename)
End If

Set wbOne = ThisWorkbook
Set wbTwo = Workbooks.Open(Filename:=Filename)

With wbOne
.Worksheets(1).Range("X9").Value = "Sample"
.Worksheets(1).Range("Y9").Value = "Name"
End With

'Copy range L10:L89 to X10

With wbTwo
.Worksheets(1).Range("O10").Copy
Destination:=wbOne.Worksheets(1).Range("AA10")
.Worksheets(1).Range("O20").Copy
Destination:=wbOne.Worksheets(1).Range("AA20")
End With

Thank you!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet setting error... Lakshmi Murthy Excel Worksheet Functions 0 September 23rd 09 03:03 PM
Setting Error #VALUE,#REF,#NAME, etc. Gulfman100 New Users to Excel 6 February 11th 09 01:33 AM
error 13 when setting worksheet listbox Amedee Van Gasse Excel Discussion (Misc queries) 1 September 24th 08 02:06 PM
Excel global setting for all workbooks? Calculation Automatic Ben Excel Discussion (Misc queries) 1 April 19th 07 04:27 PM
Global Setting For All Workbooks - Filename In Footer TOMB Excel Worksheet Functions 3 April 4th 05 06:53 PM


All times are GMT +1. The time now is 07:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"