Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Set bk = Workbooks(...)

Hi all,

In my macro, I want to use expressions like:

Do Until (Sheet1.Cells(startRow, 2).Value = 5)

But I'm having trouble "setting up" Sheet1. I've got the declaration
statements

Dim Sheet1 As Worksheet
Dim bk As Workbook

But then for the "Set" part, I'm not sure how to go about it. I've tried
(and subsequently commented out) all of the following. Can anyone see where I
am going wrong?
(The file name is quite long - Chessel 0 deg June 25th 200-275 plus 575.xls)

'Set bk = ThisWorkbook
'Set bk = Workbooks("Chessel 0 deg June 25th 200-275 plus 575")
Set bk = Workbooks("CHESSEL 0 DEG JUNE 25TH 200-275 PLUS 575")
Set Sheet1 = bk.Worksheets("TEMPDATA")
'Set Sheet1 = Worksheets("TEMPDATA")


Thanks.

Rebecca
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Set bk = Workbooks(...)

Dim bk as Workbook
Dim sh as Worksheet

set bk = workbooks("Chessel 0 deg June 25th 200-275 plus 575.xls")
set sh = bk.Worksheets("Tempdata")

sheet1 could conflict with the code name of one of you sheets.

Use the .xls extension.

--
Regards,
Tom Ogilvy



"R Dunn" wrote:

Hi all,

In my macro, I want to use expressions like:

Do Until (Sheet1.Cells(startRow, 2).Value = 5)

But I'm having trouble "setting up" Sheet1. I've got the declaration
statements

Dim Sheet1 As Worksheet
Dim bk As Workbook

But then for the "Set" part, I'm not sure how to go about it. I've tried
(and subsequently commented out) all of the following. Can anyone see where I
am going wrong?
(The file name is quite long - Chessel 0 deg June 25th 200-275 plus 575.xls)

'Set bk = ThisWorkbook
'Set bk = Workbooks("Chessel 0 deg June 25th 200-275 plus 575")
Set bk = Workbooks("CHESSEL 0 DEG JUNE 25TH 200-275 PLUS 575")
Set Sheet1 = bk.Worksheets("TEMPDATA")
'Set Sheet1 = Worksheets("TEMPDATA")


Thanks.

Rebecca

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
Regular Workbooks vs. Binary Workbooks Jerry Excel Discussion (Misc queries) 2 April 28th 10 09:11 PM
Updating Workbooks from multiple links Workbooks TimJames Excel Worksheet Functions 1 December 15th 07 03:34 PM
Copy/ move selected data from workbooks to seperate worksheets or workbooks Positive Excel Worksheet Functions 1 August 30th 07 04:54 PM
Display 2 formulas from source workbooks to destination workbooks Excel_seek_help Excel Discussion (Misc queries) 4 April 27th 06 08:13 PM
suddenly my excel workbooks are "shared workbooks" Maggie's mom Excel Discussion (Misc queries) 1 August 28th 05 09:20 PM


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