LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default how can I make a macro prompt for a portion of a file name?

I am trying to modify the macro below so that it will prompt the user for the
4 digit year and two digit month, the rest of the path and filename will
remain static... The users will need to run this on a monthly basis, we
don't want them changing the path or "Costs_Plant_HWM.txt" part of the
statement. Help?
Dim FileNum As Long, i As Long
Dim y As Variant
Dim lastrow As Integer
Range("a1").Select
Selection.End(xlDown).Select
lastrow = ActiveCell.Row
Range("a1").Select
Selection.End(xlToRight).Select
last_col = ActiveCell.Column
FileNum = FreeFile
Open "c:\200706_Costs_Plant_HCM.txt" For Append As #FileNum
For i = 1 To lastrow
With Application.WorksheetFunction
y = .Transpose(.Transpose(Range(Cells(i, 1), Cells(i, last_col))))
End With
Print #FileNum, "~" + Join(y, "~") + "~"
Next
Close #FileNum
 
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
XL VB noobie needs help - macro opening file already in use prompt Bry Excel Programming 0 August 9th 06 12:01 PM
Macro to Prompt for File -- Neophite Needs HELP kilo1990 Excel Discussion (Misc queries) 13 December 17th 05 10:34 PM
CLOSE ALL macro for XL2K (but with prompt to save for each file)? StargateFan[_3_] Excel Programming 2 August 10th 05 02:32 PM
Prompt for file name in a macro Louisville Cardinals Excel Discussion (Misc queries) 11 April 19th 05 02:39 PM
Macro: Prompt user for xls file to add chart Flystar[_4_] Excel Programming 0 May 10th 04 06:09 AM


All times are GMT +1. The time now is 02:14 AM.

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"