LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Nested With's

I'm having problems with this code (I've include more than I need to just to
show it is all initialised properly)...
Dim wb As Workbook
Dim wss As Worksheet, wss As Worksheet
Set wb = ActiveWorkbook
Application.DisplayAlerts = False
If SheetExists(BuM) Then
Sheets(BuM).Delete
End If
Application.DisplayAlerts = True
On Error Resume Next
Set wbCVR = Workbooks("CVR " & BuM & ".xls")
'Have I got file open?
If wbCVR Is Nothing Then
'No - open it
On Error GoTo 0
Workbooks.Open Filename:=".\CVR " & BuM & ".xls", UpdateLinks:=0,
ReadOnly:=True, Notify:=False
Set wsd = ActiveWorkbook.Worksheets("Detail Sheet")
Set wss = ActiveWorkbook.Worksheets("Summary")
Else
wbCVR.Activate
'Yes - use it
Set wsd = wbCVR.Worksheets("Detail Sheet")
Set wss = wbCVR.Worksheets("Summary")
End If
Application.DisplayAlerts = False
With wb
.Worksheets.Add befo=.Worksheets("Pivot Table")
With .ActiveSheet
.name = BuM
.Tab.ColorIndex = sc
wsd.Cells.Copy .Cells
End With
wss.Range("CopyOut").Copy
.Worksheets("Summary by BUM's").Cells(5, x).PasteSpecial
Paste:=xlPasteValuesAndNumberFormats 'THIS LINE WORKS Data in the right place
Application.CutCopyMode = False
.Worksheets(BuM).Select 'PROBLEM HERE! SELECT METHOD FAILED
Cells.Select
Selection.EntireRow.Hidden = False
End With

Start with summary workbok open, delete the old data sheet, insert new sheet
rename it, open another workbook and copy data from it, paste into worksheet
in first workbook, then swap to recentlycreated worksheet, now it fails, Why?

 
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
Nested IFs Alvaro Excel Worksheet Functions 4 August 12th 07 10:33 PM
Paste not working in With statement - do I have too many 'With's? robs3131 Excel Programming 9 June 26th 07 12:54 PM
nested if based on nested if in seperate sheet. how? scouserabbit Excel Worksheet Functions 5 March 2nd 07 04:03 PM
Need HELP with NESTED IF Bob Phillips Excel Discussion (Misc queries) 0 November 28th 04 01:51 PM
What is quicker? Nested or non nested ifs andycharger[_17_] Excel Programming 2 February 25th 04 03:58 PM


All times are GMT +1. The time now is 11:19 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"