Wrap your .Activate line inside of this type of structu
Dim AnyWorkbook As Workbook
For Each AnyWorkbook In Workbooks
If Left(UCase(AnyWorkbook.Name),3) = "RBA" Then
Windows(AnyWorkbook.Name).Activate
With Active Window
..... your code here
End With
End If
Next
"have_a_cup" wrote:
I have a macro I need to run daily on anywhere from 5-20 excel
reports...I've pasted the code below...the code fails out at portion
i've bolded and underlined below, and my question is:
What do I need to do, syntax wise, to make this happen regardless of
the name of the workbook....all the workbooks would be named RBA w/ a
numeral extension...
Sheets("Current Rules - 1").Select
ActiveSheet.Shapes("Picture 1").Select
Selection.Cut
Rows("1:4").Select
Range("BC1").Activate
Selection.Delete Shift:=xlUp
ActiveWorkbook.Save
Sheets("Current Rules - 1").Select
Sheets("Current Rules - 1").Copy
ActiveWindow.WindowState = xlNormal
With ActiveWindow
.Top = 105.25
.Left = -5.75
End With
*_Windows(\"rba_11.xls\").Activate_* With
ActiveWindow
.Top = 22
.Left = -76.25
End With
ActiveWindow.Close
--
have_a_cup
------------------------------------------------------------------------
have_a_cup's Profile: http://www.excelforum.com/member.php...o&userid=35394
View this thread: http://www.excelforum.com/showthread...hreadid=551672