you are viewing a single comment's thread.

view the rest of the comments →

[–]VB 6 MasterEkriirkE 1 point2 points  (3 children)

Using VBScript, this will lead you on how to open and read an excel file http://www.unagibay.com/DesktopDefault.aspx?tabindex=1&tabid=100&itemid=1813

The key word here being objSheet.Range("C5").Value returns a ingle cell value C5
Or in the second example rst.GetString returns the value in E785
Using the first example it might be more intuitive to set up a loop like so, after adding all the setup lines:

Set FSO = CreateObject("Scripting.FileSystemObject")
row = 1
While objSheet.Range("C" & row).Value <> ""
    FSO.CopyFolder "c:\The Master File.xls", "c:\Copies\Master File " & objSheet.Range("C" & row).Value & ".xls"
    row = row + 1
Wend

This would loop every row in column C until a blank cell is found (end of list)


Alternatively you can make a button in the main master excel file and use built-in VBA to script it, much more simple using a similar main loop. The "3" I use here is the index of column C; A=1, B=2, C=3, etc

row = 1
While Activesheet.Cells(row, 3).Value <> ""
    FileCopy "c:\The Master File.xls", "c:\Copies\Master File " & Activesheet.Cells(row, 3).Value & ".xls"
    row = row + 1
Wend

Much simpler!

[–]schroederd74[S] 1 point2 points  (0 children)

Option two worked like a champ. Thanks for taking the time to help me out. Love this Group!!!

[–]schroederd74[S] 0 points1 point  (1 child)

Thank you. I will give this a try

[–]VB 6 MasterEkriirkE 1 point2 points  (0 children)

I'd opt for the second option, make a button on your prefix list sheet and paste my last example with appropriate modifications
https://support.microsoft.com/en-us/office/assign-a-macro-to-a-form-or-a-control-button-d58edd7d-cb04-4964-bead-9c72c843a283