Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Namebox entries in a list box

Hi

I am currently creating a form which allows users to create a series of
text files based on the data in an excel spreadsheet. I have all the
code for the the creation of the text files but I would like to give
the user more freedom with which files they choose to create. At
present there are 448 records and the code will output all of the
records -an example of this is below:

Private Sub CreateText()

For Each Rng In Range("A2:A450")
If Rng.Value < "" Then
FNum = FreeFile
Open Rng.Value & ".txt" For Output Access Write As #FNum
Print #FNum, Rng(1, 2).Value
Print #FNum, Rng(1, 3).Value
Print #FNum, Rng(1, 4).Value
Print #FNum, Rng(1, 5).Value
Print #FNum, Rng(1, 6).Value
Print #FNum, Rng(1, 7).Value
Close #FNum
End If
Next Rng
End Sub

I would like the user to be able to use a selection from the name box
instead currently all of the records. I thought it would be easiest if
the user creates a name for their selection of cells so instead of the
above code it would read something like this:

Private Sub CreateText()

For Each Rng In Range("Name")
If Rng.Value < "" Then
FNum = FreeFile
Open Rng.Value & ".txt" For Output Access Write As #FNum
Print #FNum, Rng(1, 2).Value
Print #FNum, Rng(1, 3).Value
Print #FNum, Rng(1, 4).Value
Print #FNum, Rng(1, 5).Value
Print #FNum, Rng(1, 6).Value
Print #FNum, Rng(1, 7).Value
Close #FNum
End If
Next Rng
End Sub

This is easy enough to do but I would really like it if I could
populate a listbox on the form with names from the name box so a user
could make his selection, create a name and then be able to select this
again in the list box of the form before outputting the relevant text
files.

I hope this makes enough sense. If anybody out there has any feedback
on this it would be hugely appreciated.

Cheers,
Mike

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Namebox entries in a list box

How about an alternative idea that would make me happier as a user?

Give me a column that I can put an X in (or leave blank). Then I can use all of
excel's features to verify that I have what I want (I'm thinking
data|Filter|autofilter--or even Data|Sort).

Then you can just process the rows that have an X in that column (or non-empty
or whatever).

And as a final step, you could ask me if those X's should be cleared or left for
the next time.



Greshter wrote:

Hi

I am currently creating a form which allows users to create a series of
text files based on the data in an excel spreadsheet. I have all the
code for the the creation of the text files but I would like to give
the user more freedom with which files they choose to create. At
present there are 448 records and the code will output all of the
records -an example of this is below:

Private Sub CreateText()

For Each Rng In Range("A2:A450")
If Rng.Value < "" Then
FNum = FreeFile
Open Rng.Value & ".txt" For Output Access Write As #FNum
Print #FNum, Rng(1, 2).Value
Print #FNum, Rng(1, 3).Value
Print #FNum, Rng(1, 4).Value
Print #FNum, Rng(1, 5).Value
Print #FNum, Rng(1, 6).Value
Print #FNum, Rng(1, 7).Value
Close #FNum
End If
Next Rng
End Sub

I would like the user to be able to use a selection from the name box
instead currently all of the records. I thought it would be easiest if
the user creates a name for their selection of cells so instead of the
above code it would read something like this:

Private Sub CreateText()

For Each Rng In Range("Name")
If Rng.Value < "" Then
FNum = FreeFile
Open Rng.Value & ".txt" For Output Access Write As #FNum
Print #FNum, Rng(1, 2).Value
Print #FNum, Rng(1, 3).Value
Print #FNum, Rng(1, 4).Value
Print #FNum, Rng(1, 5).Value
Print #FNum, Rng(1, 6).Value
Print #FNum, Rng(1, 7).Value
Close #FNum
End If
Next Rng
End Sub

This is easy enough to do but I would really like it if I could
populate a listbox on the form with names from the name box so a user
could make his selection, create a name and then be able to select this
again in the list box of the form before outputting the relevant text
files.

I hope this makes enough sense. If anybody out there has any feedback
on this it would be hugely appreciated.

Cheers,
Mike


--

Dave Peterson
Reply
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
blank entries in data validation list WiFiMike2006 Excel Worksheet Functions 2 December 13th 06 07:33 PM
Best way to get a list of unique entries in a field [email protected] Excel Worksheet Functions 2 January 19th 06 10:30 PM
Limiting Entries in A List Box Dave C Excel Worksheet Functions 1 January 3rd 06 06:55 PM
Merge, update, and add only new entries into a list from other she Chab Excel Worksheet Functions 1 May 1st 05 11:05 PM
Insert column entries from a master list RichLorn Excel Worksheet Functions 0 October 28th 04 08:57 PM


All times are GMT +1. The time now is 06:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"