Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copying Name Ranges along with Worksheets


Hi All,

I'm building a forecasting tool - on (hypothetically) Month2, I am
"importing" sheets from the previous Month's Excel file.

Set objBook = Workbooks.Open(openWorkbook)
Set objApp = objBook.Parent
Set objSheet = objBook.Worksheets("FDP Archive")

'Delete Current FDP Sheet
With ThisWorkbook
..Sheets("FDP Archive").Delete
End With

With objSheet
..Visible = True
..Select
..Copy After:=Workbooks(wBook).Sheets(numSheets) 'Copy
after last worksheet in workbook
..Visible = False
End With

Copying the sheet into my new month's workbook works perfectly, however
I am *also inadvertantly* copying Named Ranges from the previous month
as well, which is screwing up my charts.

Is there a way to copy a sheet *without* copying any associated Name
Ranges?

Thanks!


--
cratediggah
------------------------------------------------------------------------
cratediggah's Profile: http://www.excelforum.com/member.php...o&userid=30363
View this thread: http://www.excelforum.com/showthread...hreadid=572249

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Copying Name Ranges along with Worksheets

Set objBook = Workbooks.Open(openWorkbook)
Set objApp = objBook.Parent
Set objSheet = objBook.Worksheets("FDP Archive")
objSheet.Cells.Replace What:="=", _
Replacement:="ZZZ=", _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False

'Delete Current FDP Sheet
Application.DisplayAlerts = False
With ThisWorkbook
..Sheets("FDP Archive").Delete
End With
Application.DisplayAlerts = True

With objSheet
..Visible = True
..Select
..Copy After:=Workbooks(wBook).Sheets(numSheets) 'Copy
..Visible = False
End With

ActiveSheet.Cells.Replace What:="ZZZ=", _
Replacement:="=", _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False

ObjSheet.Cells.Replace What:="ZZZ=", _
Replacement:="=", _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False

--
Regards,
Tom Ogilvy

"cratediggah" wrote:


Hi All,

I'm building a forecasting tool - on (hypothetically) Month2, I am
"importing" sheets from the previous Month's Excel file.

Set objBook = Workbooks.Open(openWorkbook)
Set objApp = objBook.Parent
Set objSheet = objBook.Worksheets("FDP Archive")

'Delete Current FDP Sheet
With ThisWorkbook
.Sheets("FDP Archive").Delete
End With

With objSheet
.Visible = True
.Select
.Copy After:=Workbooks(wBook).Sheets(numSheets) 'Copy
after last worksheet in workbook
.Visible = False
End With

Copying the sheet into my new month's workbook works perfectly, however
I am *also inadvertantly* copying Named Ranges from the previous month
as well, which is screwing up my charts.

Is there a way to copy a sheet *without* copying any associated Name
Ranges?

Thanks!


--
cratediggah
------------------------------------------------------------------------
cratediggah's Profile: http://www.excelforum.com/member.php...o&userid=30363
View this thread: http://www.excelforum.com/showthread...hreadid=572249


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
Copying Worksheets which contain Named Ranges Terry Bennett Excel Worksheet Functions 0 June 25th 09 05:04 PM
Copying ranges Don Lloyd Excel Programming 4 August 11th 05 11:19 PM
Copying ranges of data between worksheets Christopher R. Lee Excel Worksheet Functions 0 February 3rd 05 08:56 PM
copying ranges etc chick-racer[_43_] Excel Programming 0 November 27th 03 02:33 PM
Copying ranges brym Excel Programming 8 July 19th 03 04:27 PM


All times are GMT +1. The time now is 11:40 PM.

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"