Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to change windows using the following code whereas the name of
the file is located in cell "C27" of the worksheet "Customize": Windows("" & Sheets("Customize").Range("C27").Value & "").Activate The code is not working (I've tried several variations). Please Advise. Thanks. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Windows(Sheets("Customize").Range("C27").Value).Ac tivate
or Windows(Sheets("Customize").Range("C27").Value & ".xls").Activate if you don't have .xls on the end of your workbook name. of course if you are not in the workbook that contains sheet Customize (assume workbook name is Test.xls) Dim bk as workbook, bk1 as workbook Dim sStr as String set bk = workbooks("Test.xls") sStr = bk.Worksheets("Customize").Range("C27").Value if lcase(right(sStr,4)) < ".xls" then sStr = sStr & ".xls" end if On error resume next set bk1 = Workbooks(sStr) On Error goto 0 if bk1 is nothing then msgbox sStr & " is not an existing open workbook" else bk1.Activate End if -- Regards, Tom Ogilvy "Carl Bowman" wrote in message ... I am trying to change windows using the following code whereas the name of the file is located in cell "C27" of the worksheet "Customize": Windows("" & Sheets("Customize").Range("C27").Value & "").Activate The code is not working (I've tried several variations). Please Advise. Thanks. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks again. This has solved all my "puzzles". You have been very patient!
Carl "Tom Ogilvy" wrote: Windows(Sheets("Customize").Range("C27").Value).Ac tivate or Windows(Sheets("Customize").Range("C27").Value & ".xls").Activate if you don't have .xls on the end of your workbook name. of course if you are not in the workbook that contains sheet Customize (assume workbook name is Test.xls) Dim bk as workbook, bk1 as workbook Dim sStr as String set bk = workbooks("Test.xls") sStr = bk.Worksheets("Customize").Range("C27").Value if lcase(right(sStr,4)) < ".xls" then sStr = sStr & ".xls" end if On error resume next set bk1 = Workbooks(sStr) On Error goto 0 if bk1 is nothing then msgbox sStr & " is not an existing open workbook" else bk1.Activate End if -- Regards, Tom Ogilvy "Carl Bowman" wrote in message ... I am trying to change windows using the following code whereas the name of the file is located in cell "C27" of the worksheet "Customize": Windows("" & Sheets("Customize").Range("C27").Value & "").Activate The code is not working (I've tried several variations). Please Advise. Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using TEXT and &TEXT - display numbers with commas, underline text | Excel Discussion (Misc queries) | |||
Text does not display in "Text boxs" and when wrapping text in a c | Excel Discussion (Misc queries) | |||
want to remove all text characters equal to one character in length from text string | Excel Worksheet Functions | |||
Auto Duplicating Worksheets and Insterting Data from Different Worksheet | Excel Programming | |||
extracting text from within a cell - 'text to rows@ equivalent of 'text to columns' | Excel Programming |