Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
dan dan is offline
external usenet poster
 
Posts: 866
Default VBA - Do Loop or SaveChanges = false

Does Excel 2003's DO Until LOOP have a buffer?
Using VBA, I am opening a master file and then loop through 77 more files to
copy a sheet to the master file. All works without Excel throwing a dialog
asking to save changes until the 73 file. I can move the 73rd file up in to
the loop and Excel does not throw the dialog. This tells me there is nothing
wrong with the file. Any help would be appreciated.

This is the code:
Sub Combine_Files()
Application.DisplayAlerts = False
Application.ScreenUpdating = False

w = ActiveCell.Value
ww = ActiveCell.Offset(0, -1).Value
a = Range("period").Value
F = Range("formatting").Value
vv = Application.Sheets.Parent.Name

dir_select = "c:\peoplesoft nvision reports\2009\oney group\" & a & "\"
Workbooks.Open Filename:=dir_select & w

Sheets("P&L").Select
Sheets("P&L").Name = ww

Windows("oney files to sups").Activate
ActiveCell.Offset(1, 0).Select

Do Until ActiveCell.Value = ""
z = ActiveCell.Address
x = ActiveCell.Value
xx = ActiveCell.Offset(0, -1).Value
cc = ActiveCell.Offset(0, -2).Value

dir_select = "c:\peoplesoft nvision reports\2009\oney group\" & a & "\"
Workbooks.Open Filename:=dir_select & x

Sheets("P&L").Select
ActiveSheet.Select

ActiveSheet.Copy Befo=Workbooks(w).Sheets(ww)
ActiveWorkbook.Sheets("P&L").Tab.ColorIndex = cc
Sheets("P&L").Name = xx

If F = "LIZ" Then
ActiveSheet.Outline.ShowLevels RowLevels:=1
End If

Workbooks(x).Close SaveChanges:=False

Windows("oney files to sups.xls").Activate

Range(z).Select
ActiveCell.Offset(1, 0).Select
Loop

Workbooks(w).Activate
Sheets(ww).Select

Application.ScreenUpdating = True

msg = "Do not pass go, do not collect $200"
MsgBox msg & Chr(13) & "until you save this file!"
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,805
Default VBA - Do Loop or SaveChanges = false

I don't think so... Ultimately all software applications have physical limits
based on your software configuration and system memory but looping through 77
files is well within the limits of most of the present day systems.

Does it still throw the warning after 73 files even if you move the offendng
file up?

Just to complete your task, you may save after processing each file and find
out the cause later :-)

"Dan" wrote:

Does Excel 2003's DO Until LOOP have a buffer?
Using VBA, I am opening a master file and then loop through 77 more files to
copy a sheet to the master file. All works without Excel throwing a dialog
asking to save changes until the 73 file. I can move the 73rd file up in to
the loop and Excel does not throw the dialog. This tells me there is nothing
wrong with the file. Any help would be appreciated.

This is the code:
Sub Combine_Files()
Application.DisplayAlerts = False
Application.ScreenUpdating = False

w = ActiveCell.Value
ww = ActiveCell.Offset(0, -1).Value
a = Range("period").Value
F = Range("formatting").Value
vv = Application.Sheets.Parent.Name

dir_select = "c:\peoplesoft nvision reports\2009\oney group\" & a & "\"
Workbooks.Open Filename:=dir_select & w

Sheets("P&L").Select
Sheets("P&L").Name = ww

Windows("oney files to sups").Activate
ActiveCell.Offset(1, 0).Select

Do Until ActiveCell.Value = ""
z = ActiveCell.Address
x = ActiveCell.Value
xx = ActiveCell.Offset(0, -1).Value
cc = ActiveCell.Offset(0, -2).Value

dir_select = "c:\peoplesoft nvision reports\2009\oney group\" & a & "\"
Workbooks.Open Filename:=dir_select & x

Sheets("P&L").Select
ActiveSheet.Select

ActiveSheet.Copy Befo=Workbooks(w).Sheets(ww)
ActiveWorkbook.Sheets("P&L").Tab.ColorIndex = cc
Sheets("P&L").Name = xx

If F = "LIZ" Then
ActiveSheet.Outline.ShowLevels RowLevels:=1
End If

Workbooks(x).Close SaveChanges:=False

Windows("oney files to sups.xls").Activate

Range(z).Select
ActiveCell.Offset(1, 0).Select
Loop

Workbooks(w).Activate
Sheets(ww).Select

Application.ScreenUpdating = True

msg = "Do not pass go, do not collect $200"
MsgBox msg & Chr(13) & "until you save this file!"
End Sub

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
What's the best way to toggle between true and false in Excel? Hiall, My excel work involves a lot of toggling between true and false (booleantypes) ... and it's very repetitive... Is there a way to select a bunch ofcells, and press a key short-cu LunaMoon Excel Discussion (Misc queries) 9 July 29th 08 12:28 AM
How to loop saman110 via OfficeKB.com Excel Discussion (Misc queries) 4 July 25th 07 01:09 AM
$C$1972,2,FALSE, $C$1972,3,FALSE is ok, But $C$1972,4,FALSE Give # Steved Excel Worksheet Functions 6 July 3rd 06 01:49 AM
getting out of a if loop rk0909 Excel Discussion (Misc queries) 3 April 11th 06 03:55 PM
IF(a1="x",(vlookup 18K rows,2,false),(vlookup 18K,3,false)) RAM? bchilt Excel Worksheet Functions 6 January 20th 06 09:21 AM


All times are GMT +1. The time now is 09:44 AM.

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"