Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Insterting Text Into

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Insterting Text Into

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Insterting Text Into

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
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
Using TEXT and &TEXT - display numbers with commas, underline text Gary Excel Discussion (Misc queries) 3 May 5th 23 03:46 AM
Text does not display in "Text boxs" and when wrapping text in a c Esteban Excel Discussion (Misc queries) 1 March 8th 07 11:59 PM
want to remove all text characters equal to one character in length from text string [email protected] Excel Worksheet Functions 1 April 18th 05 09:56 PM
Auto Duplicating Worksheets and Insterting Data from Different Worksheet doc_in_bc Excel Programming 4 April 26th 04 02:37 AM
extracting text from within a cell - 'text to rows@ equivalent of 'text to columns' Dan E[_2_] Excel Programming 4 July 30th 03 06:43 PM


All times are GMT +1. The time now is 12:56 PM.

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

About Us

"It's about Microsoft Excel"