View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Ray Clark[_2_] Ray Clark[_2_] is offline
external usenet poster
 
Posts: 22
Default activating workbooks

I am trying to put some code together where I can copy a list of dates from
one file to another if they are different with the destination file name
having part of the file name varying from month to month.
This is what I have got so far but I get the message subscript out of range.

Sub Update_Ethane_Email_File()
If MthNum < 10 Then
Workbooks.Open Filename:="M:\KOLOPSMB\Post Conversion Files\Current
Year\0" & MthNum & " " & Left(MthName, 3) & " Data.xls", _
UpdateLinks:=0
Else
Workbooks.Open Filename:="M:\KOLOPSMB\Post Conversion Files\Current
Year\" & MthNum & " " & Left(MthName, 3) & " Data.xls", _
UpdateLinks:=0
End If
Workbooks.Open Filename:="M:\KOLOPSMB\Weekly and Monthly Emails\Ethane
Transfer Data " & MthName & ".xls", _
UpdateLinks:=0
Range("A5").Select
If ActiveCell.Value < DayOne Then
Windows("Create Email Notifications.xls").Activate
Range("Date_Field").Select
Selection.Copy
Windows("Ethane Transfer Data " & MthName & ".xls").Activate

End If
End Sub

Appreciate any help.

Thanks
Ray