Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Assume there are only two visible workbooks (spreadsheets) Dim bk as Workbook, bk1 as Workbook, bk2 as Workbook for each bk in Workbooks if bk.Windows(1).Visible then if lcase(bk.name) < "constant.xls" then sName = bk.name exit sub end if end if Next set bk2 = workbooks(sname) set bk1 = workbooks("constant.xls") Obviously change constant.xls to the name (in lowercase) of the fixed name workbook If you meant sheets in the same workbook, then just use worksheet/worksheets instead of workbook/workbooks -- Regards, Tom Ogilvy "markmidwest" wrote: I am trying to create a macro that goes across 2 spreadsheets, the name of the first spreadsheet will remane consistent but the second spreadsheet will have a randomly generated name. I created a macro that runs the functions that I need but only if the second spreadsheet name doesn't change, once it changes I get errors. Is there a way to create a macro like this? Thank you in advance for your help. -Mark |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
File Names within a Macro Function | Excel Worksheet Functions | |||
Macro File Names | Excel Worksheet Functions | |||
Macro File Names | Excel Worksheet Functions | |||
VBA macro to obtain file names using WIN32 API | Excel Programming |