Form to select 2 spreadsheets
In Chip Pearson's macro to compare 2 spreadsheets, he uses a form in
which you enter the names of the 2 spreadsheets you wish to compare. I'd like to use that same form for a macro I'm writing which compares the rows in 2 spreadsheets and does some manipulations on them. I looked at the code for Chip's macro, tried to copy what I thought were the appropriate parts into my spreadsheet, and run it. It didn't work. I'm not sure if I got the right code, his macro is so advanced to me that I couldn't make sense of most of it. I tried to modify Chip's form by removing the controls I didn't need, then exporting it to another directory, change the name, the import it back in, but that didn't work either. What I'd like to do is have a form that allows the user to select 2 files from any open files, just like Chip's does, but then have my code run on those files. Can anyone help me here, point me in more productive directions? |
Form to select 2 spreadsheets
Have 2 list boxes on your form, populate them with the names of the open
workbooks - this code snippet gives an idea of the necessary For Each ws In Application.Workbooks MsgBox ws.Name Next add the ws.name to the listbox, then use the selected text of the listbox to determine which file to run it on. "davegb" wrote in message oups.com... In Chip Pearson's macro to compare 2 spreadsheets, he uses a form in which you enter the names of the 2 spreadsheets you wish to compare. I'd like to use that same form for a macro I'm writing which compares the rows in 2 spreadsheets and does some manipulations on them. I looked at the code for Chip's macro, tried to copy what I thought were the appropriate parts into my spreadsheet, and run it. It didn't work. I'm not sure if I got the right code, his macro is so advanced to me that I couldn't make sense of most of it. I tried to modify Chip's form by removing the controls I didn't need, then exporting it to another directory, change the name, the import it back in, but that didn't work either. What I'd like to do is have a form that allows the user to select 2 files from any open files, just like Chip's does, but then have my code run on those files. Can anyone help me here, point me in more productive directions? |
Form to select 2 spreadsheets
Heather Heritage wrote: Have 2 list boxes on your form, populate them with the names of the open workbooks - this code snippet gives an idea of the necessary For Each ws In Application.Workbooks MsgBox ws.Name Next add the ws.name to the listbox, then use the selected text of the listbox to determine which file to run it on. Thanks for your reply. How do I "populate then with the names of the open workbooks", without typing them in? "davegb" wrote in message oups.com... In Chip Pearson's macro to compare 2 spreadsheets, he uses a form in which you enter the names of the 2 spreadsheets you wish to compare. I'd like to use that same form for a macro I'm writing which compares the rows in 2 spreadsheets and does some manipulations on them. I looked at the code for Chip's macro, tried to copy what I thought were the appropriate parts into my spreadsheet, and run it. It didn't work. I'm not sure if I got the right code, his macro is so advanced to me that I couldn't make sense of most of it. I tried to modify Chip's form by removing the controls I didn't need, then exporting it to another directory, change the name, the import it back in, but that didn't work either. What I'd like to do is have a form that allows the user to select 2 files from any open files, just like Chip's does, but then have my code run on those files. Can anyone help me here, point me in more productive directions? |
All times are GMT +1. The time now is 10:59 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com