Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Change sheet reference in new workbook

I am hoping someone can help with this problem. I have a workbook which
is called Forecast for 2005.xlt which has 13 sheets. One sheet,
"Months", is used as a reference for a drop down list (forms toolbar)
on all of the other sheets. This is set by Right Click Format Control
and then enter Months!$A$1:$A$13. Everything works fine until I try to
create a new workbook. Using VBA I copy the last sheet in the old
workbook, the "Months" sheet, and the code module to the new workbook.
The problem is that the drop down list in the new workbook still refers
to the "Months" sheet from the old workbook ( '[Forecast for
2005.xlt]Months'!$A$1:$A$13 ). Is there anyway that I can set the
reference to the workbook that the drop down is in? I have looked at a
lot of these postings and have not been able to find a problem like
this one. Thank you in advance for any help offered.

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Change sheet reference in new workbook

Are you copying the stuff using code or manually?

If manually, you can change the range by rightclicking on each of the dropdowns.

Or you could use some code.

I assumed that the dropdown was always named "drop down 1" on each sheet.

Option Explicit
Sub testme()
Dim myDD As DropDown
Dim wks As Worksheet

For Each wks In ActiveWorkbook.Worksheets
Set myDD = Nothing
On Error Resume Next
Set myDD = wks.DropDowns("drop down 1")
On Error GoTo 0

If myDD Is Nothing Then
'skip this worksheet
Else
myDD.ListFillRange _
= ActiveWorkbook.Worksheets("months").Range("a1:a13" ) _
.Address(external:=True)
myDD.LinkedCell = wks.Range("a1").Address(external:=True)
End If
Next wks
End Sub

wrote:

I am hoping someone can help with this problem. I have a workbook which
is called Forecast for 2005.xlt which has 13 sheets. One sheet,
"Months", is used as a reference for a drop down list (forms toolbar)
on all of the other sheets. This is set by Right Click Format Control
and then enter Months!$A$1:$A$13. Everything works fine until I try to
create a new workbook. Using VBA I copy the last sheet in the old
workbook, the "Months" sheet, and the code module to the new workbook.
The problem is that the drop down list in the new workbook still refers
to the "Months" sheet from the old workbook ( '[Forecast for
2005.xlt]Months'!$A$1:$A$13 ). Is there anyway that I can set the
reference to the workbook that the drop down is in? I have looked at a
lot of these postings and have not been able to find a problem like
this one. Thank you in advance for any help offered.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Change sheet reference in new workbook

You're my hero! Thank you so much for you reply. It works like a charm!

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
Formulas not recalculating when values change on another sheet Bill Excel Worksheet Functions 0 September 15th 05 10:29 PM
text color change in cell reference TomKat743 Excel Discussion (Misc queries) 3 June 16th 05 12:38 AM
How do I reference non-contiguous columns in another sheet and th. Bill Nash Excel Discussion (Misc queries) 3 March 3rd 05 05:47 PM
Need formula for sheet & cell reference MPH Excel Worksheet Functions 0 January 16th 05 03:39 PM
Problem with shared workbook (history sheet) ACH Excel Worksheet Functions 2 December 9th 04 08:39 PM


All times are GMT +1. The time now is 04:13 PM.

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"