Reference Multiple Tabs from Project to Excel

S

Sandra

Hello Everyone,

I'm writing a bit of code to write specific data into Excel from MSProject.
I would like to put each Cost Account Manager's name on an individual
worksheet tab in one Excel workbook.

Everything is working well, I can add the worksheets but when write the data
from Project to Excel it writes it on the first worksheet listed. How do I
reference the other worksheets from inside Project to create separate manager
lists?

Thank you so much for your help!

Sandra
 
R

Rod Gill

Firstly I assume you have a variable set up that points to Excel, so:
xlApp.Worksheets("Sheet1").Range("C1")="Sheet 1 Title"
xlApp.Worksheets("Sheet2").Range("C1")="Sheet 2 Title"
 
S

Sandra

Hello Rod and Thanks!

Yes...I have my variables set up that point to Excel. I've already used the
code you had below below but still getting errors. I thought I was missing
something. Ok..I AM still missing something and It'll take some research to
figure it out.

THANKS for the help!!!!!! :)
 
J

Joe Cletcher

I use the following in VisualBasic .Net to switch between worksheets.

xlApp.Sheets( 1).select() ' Selects sheet 1
xlApp.Sheets(2).select() ' Selects sheet 2, etc.

I think you can also select by worksheet name as

xlApp.Sheets("A Worksheet Name").select()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top