Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Switch between unknown wbk name grab a value and go back

I know this is going to easy, but for the life of me...
I would like to be able to go thru all open workbooks and switch to one
whose name changes all the time but has the same beginning,
GetReadySheet_*.xls.
I found this code

Sub ListBooks()
Dim wbk As Workbook
For Each wbk In Workbooks
MsgBox wbk.Name
Next wbk
End Sub

but I dont know enough to be able to use the
Windows(€œGetReadySheet_*.xls€).Activate to go to the GetReadySheet workbook,
grab a cell value out of E6 and then go back to the file with the code. Any
thoughts€¦

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Switch between unknown wbk name grab a value and go back

Sub ListBooks()
Dim wbk As Workbook
Dim sValue As String
For Each wbk In Workbooks
If Left(wbk.Name, 13) = "GetReadySheet" Then
sValue = wbk.Worksheets("WorkSheetName").Range("E1").Value
End If
Next wbk
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Switch between unknown wbk name grab a value and go back


Dim wbk As Workbook
dim i as integer

do
i=i+1
loop until lefT(wbk.Name,len("GetReadySheet")="GetReadySheet"

myval=wkb.worksheets("Sheet1").range("E6")

or some such

hope this helps
Dale Wrote:
I know this is going to easy, but for the life of me...
I would like to be able to go thru all open workbooks and switch to
one
whose name changes all the time but has the same beginning,
GetReadySheet_*.xls.
I found this code

Sub ListBooks()
Dim wbk As Workbook
For Each wbk In Workbooks
MsgBox wbk.Name
Next wbk
End Sub

but I dont know enough to be able to use the
Windows(€œGetReadySheet_*.xls€).Activate to go to the GetReadySheet
workbook,
grab a cell value out of E6 and then go back to the file with the code.
Any
thoughts€¦



--
tony h
------------------------------------------------------------------------
tony h's Profile: http://www.excelforum.com/member.php...o&userid=21074
View this thread: http://www.excelforum.com/showthread...hreadid=533933

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Switch between unknown wbk name grab a value and go back

Works great but I did not notice before the worksheet does not have a
standard name either. What would I do fo ("WorkSheetName") ?

" wrote:

Sub ListBooks()
Dim wbk As Workbook
Dim sValue As String
For Each wbk In Workbooks
If Left(wbk.Name, 13) = "GetReadySheet" Then
sValue = wbk.Worksheets("WorkSheetName").Range("E1").Value
End If
Next wbk
End Sub


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Switch between unknown wbk name grab a value and go back

If you only have one worksheet in that "getreadysheet*.xls" workbook, then you
could use:

sValue = wbk.Worksheets(1).Range("E1").Value

If you have more than one worksheet, how do you know which one to use?

Dale wrote:

Works great but I did not notice before the worksheet does not have a
standard name either. What would I do fo ("WorkSheetName") ?

" wrote:

Sub ListBooks()
Dim wbk As Workbook
Dim sValue As String
For Each wbk In Workbooks
If Left(wbk.Name, 13) = "GetReadySheet" Then
sValue = wbk.Worksheets("WorkSheetName").Range("E1").Value
End If
Next wbk
End Sub



--

Dave Peterson
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
How do I switch from 1,2,3... back to A,B,C... column reference na C. White Excel Discussion (Misc queries) 7 November 12th 08 05:48 PM
why does the link status always reverts back to UNKNOWN? Rupa Excel Discussion (Misc queries) 0 February 28th 06 02:15 PM
How do I switch openoffice back to excel Bill9669 Excel Programming 1 January 18th 06 10:53 PM
How to switch column headers from numbers back to letters? Measurement Consultant Excel Worksheet Functions 2 January 14th 06 03:30 PM
Can I switch back to Excel sheet while a form is shown? Ai_Jun_Zhang[_7_] Excel Programming 2 August 31st 05 01:57 AM


All times are GMT +1. The time now is 02:10 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"