LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Select last months file

This might take you forward

Const sFile As String = "gAMS_Report_"
Dim sFilename As String
Dim sThis As Workbook
Dim sLast As Workbook
Dim ThisMonth As String

ThisMonth = "Oct"
sFilename = sFile & Format(DateValue("01-" & ThisMonth & "-" &
Year(Date)), "mmm_yy")
Set oWBThis = Workbooks.Open(sFile)
sFilename = sFile & Format(DateValue("01-" & ThisMonth & "-" &
Year(Date)) - 1, "mmm_yy")
Set oWBLast = Workbooks.Open(sFile)


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Les" wrote in message
ups.com...
Hi Bob,

I have the month in format mmm. The variable is actually "ThisMonth"

regards,

Les

Bob Phillips wrote:
As I said, what is in that variable Month?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Les Stout" wrote in message
...
Hi Bob, I am sure your code will work, sorry as said before i am not a
programmer and did not understand the <Date. I however do get an

error
as per my last thread.

best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***






 
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
How to print select months from worksheet pinkluxe Excel Discussion (Misc queries) 2 September 30th 08 01:30 AM
How do I select 13 months from a data range for charts marg Charts and Charting in Excel 3 March 14th 07 06:30 AM
Prompt user to select file with default file selected dialog Bruce Cooley Excel Programming 0 September 15th 03 06:43 AM
Prompt user to select file with default file selected dialog Bob Phillips[_5_] Excel Programming 0 September 14th 03 09:22 PM
Prompt user to select file with default file selected dialog Bob Phillips[_5_] Excel Programming 0 September 14th 03 09:19 PM


All times are GMT +1. The time now is 04:30 PM.

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"