View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
bigdaddy3 bigdaddy3 is offline
external usenet poster
 
Posts: 23
Default I want a macro that can open a worksheet in a closed workbook

jim,would i have to add that code after the initial code that calls up the
workbook ie workbooks.open(file path) then your code
--
BD3


"Jim Thomlinson" wrote:

Do you know the name of the sheet? If so then just open the book and
reference the sheet that you want.

dim wbk as workbook
dim wks as worksheet

set wbk = workbooks.open "C:'MyBook.xls"
set wks = wbk.Sheet1

wks is now referencing sheet1 in MyBook.
--
HTH...

Jim Thomlinson


"bigdaddy3" wrote:

I know jim but i want to reference certain cells in that sheet and i need to
be able to open it at that sheet not any other in the workbook
--
BD3


"Jim Thomlinson" wrote:

Sheets are contained within books. You have to open the book to get the
sheet...
--
HTH...

Jim Thomlinson


"bigdaddy3" wrote:

I would like to write a macro that will open a particular worksheet in a
closed workbook that contains named sheets,when i use the application.open
route with the path details, i can get the whole book to open but i want a
particular sheet of that book. Can anyone help please
--
BD3