Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Link Formulas

Please help...

I have been looking for a solution to this problem for a
couple of years now.. but can't seem to get around it..

I have a workbook ([Job Analysis 2004.xls]) with macro
that I run that:

1. Copies a mastersheet within the workbook to a new
sheet.

2. Sets new name of the sheet, let say "04-500"

3. Using the variable LstYrMat"='[Job Analysis 2003.xls]"
& JobNo & "'!$B$23, I create a formula in a cell to link
to sheet "04-500" in last years workbook ([Job Analysis )
2003.xls]"

My problem is that if the sheet did not exist in last
years workbook, when I set the formula in the cell, I get
the "Select Sheet" dialog box. I can't seem to find a way
to dismiss the dialog box programmatically. The user has
to sit there and hit cancel several times.

Any help I can get would be greatly, greatly appreciated.

Jeannie Flores


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 340
Default Link Formulas

I don't believe there is a way to dismiss the dialog via code. Why not have
your macro open up the target workbook and see if the worksheet is there
before you write a formula referencing it? If you are concerned about
screen activity, you can use

application.screenupdating = false

to hide screen activity, and set back to true to show activity.

To see if a sheet exists once you open the workbook, do something like:

dim oS as worksheet
on error resume next
set oS = worksheets("somesheetname")
on errror goto 0
if os is nothing then
'code to handle no sheet exists
end if

To close the target workbook and not save, use

workbooks("Job Analysis 2003.xls").close false

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Jeannie Flores" wrote in message
...
Please help...

I have been looking for a solution to this problem for a
couple of years now.. but can't seem to get around it..

I have a workbook ([Job Analysis 2004.xls]) with macro
that I run that:

1. Copies a mastersheet within the workbook to a new
sheet.

2. Sets new name of the sheet, let say "04-500"

3. Using the variable LstYrMat"='[Job Analysis 2003.xls]"
& JobNo & "'!$B$23, I create a formula in a cell to link
to sheet "04-500" in last years workbook ([Job Analysis )
2003.xls]"

My problem is that if the sheet did not exist in last
years workbook, when I set the formula in the cell, I get
the "Select Sheet" dialog box. I can't seem to find a way
to dismiss the dialog box programmatically. The user has
to sit there and hit cancel several times.

Any help I can get would be greatly, greatly appreciated.

Jeannie Flores




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
Clean report without any link and formulas Udayan Excel Discussion (Misc queries) 1 March 27th 09 05:54 AM
link formulas Joe Excel Discussion (Misc queries) 1 July 30th 07 07:03 PM
Pasting formulas without the link help [email protected] Excel Discussion (Misc queries) 1 August 30th 06 08:21 PM
link formulas in excel Dea Excel Worksheet Functions 1 June 29th 05 04:40 PM
Formulas link cells Mike Excel Worksheet Functions 0 March 3rd 05 08:11 PM


All times are GMT +1. The time now is 12:17 AM.

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

About Us

"It's about Microsoft Excel"