LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Macro for creating dynamic filenames

You're right, I totally failed to mention that. I apologize...and I also
bow down before you and your Excel mastery. Thank you!!!!!

-Brian

"Bob Phillips" wrote in message
...
You never mentioned there could be multiples per month!

Function DynFilename(Business, LetterId) As String
Dim cell As Range
Dim colMonths As Collection
Dim itm

Set colMonths = New Collection
DynFilename = Business & "_" & LetterId & "_"
For Each cell In ActiveSheet.Range("Businesses")
If cell.Value = Business And cell.Offset(0, 1).Value = LetterId
Then
On Error Resume Next
colMonths.Add Format(cell.Offset(0, 2).Value, "mmm"), _
Format(cell.Offset(0, 2).Value, "mmm")
On Error GoTo 0
End If
Next cell

For Each itm In colMonths
DynFilename = DynFilename & itm
Next itm
End Function


--
HTH

Bob Phillips

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



 
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
Dynamic Range with unused formula messing up x axis on dynamic graph [email protected] Charts and Charting in Excel 2 February 2nd 06 08:02 PM
dynamic sort macro across 3 linked sheets wrpalmer Excel Discussion (Misc queries) 0 December 11th 05 02:17 AM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Highlight Range - wrong macro, please edit. Danny Excel Worksheet Functions 8 October 19th 05 11:11 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


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