ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   help with code (https://www.excelbanter.com/excel-programming/381370-re-help-code.html)

Jason Lepack

help with code
 
Hmm... that's no good eh?

I think that I said that you could use Environ("username") to get the
Windows User Name of the person who's currently logged in to the PC and
then go from there.

Cheers,
Jason Lepack

timmulla wrote:
I didn't see any comments in your post.
--
Regards,

timmulla


"timmulla" wrote:

I have a spreadsheet with the following inputs.

Cell B1 = names (Adam, Tim , Jerry , Joe, John, Bill, Jen)

Cell B2 = Day of the week (Monday, Tuesday, Wednesday, Thursday, Friday,
Saturday, Sunday)

The selections in cell B1 and B2 are automatically generating the
appropriate data in cell B3 and range B5:B10. I then have the following the
code to write range B5:B10 to a text file:

Sub Macro5()
Dim FName As String
Dim FNum As Integer
Dim Rng As Range
FName = "C:\Documents and Settings\tmullady\Desktop\Test.txt"
FNum = FreeFile
Open FName For Output Access Write As #FNum
Print #FNum, Range("B3").Text
For Each Rng In Range("B5:B10")
Print #FNum, Rng.Text
Next Rng
Close #FNum
End Sub

I created a form that enables a user to select the day of the week, which
will populate cell B2. I need help writing code that will automatically
change the contents in cell B1 for each of the people (Adam, Tim , Jerry ,
Joe, John, Bill, Jen) and then write the contents range B5:B10 to a text
file. Basically, I want a user to select a day in the week which will
automatically generate 7 different text files. The text files need to be
named based on the text in cell B3.

Any help would be appreciated.


--
Regards,

timmulla




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com