Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Modify function for another workbook

Hi,

I have these 2 functions which let me read/write to a cell.

Sub WriteCell(mSheet, mVal, mCell)
ActiveWorkbook.Worksheets(mSheet).Range(mCell).Val ue = LTrim(mVal)
End Sub
Function ReadCell(mSheet, mCell)
ReadCell = ActiveWorkbook.Worksheets(mSheet).Range(mCell).Val ue
End Function

This lets me specify the worksheet, but what if I have/want to use
another workbook?

I presume wookbook is the VBAProject name from the Project window?

Thanks - Kirk
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Modify function for another workbook

No it is the book name

Workbooks("my other book.xls")

instead of activeWorkbook.

Pass it as a parameter like the rest.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"kirkm" wrote in message
...
Hi,

I have these 2 functions which let me read/write to a cell.

Sub WriteCell(mSheet, mVal, mCell)
ActiveWorkbook.Worksheets(mSheet).Range(mCell).Val ue = LTrim(mVal)
End Sub
Function ReadCell(mSheet, mCell)
ReadCell = ActiveWorkbook.Worksheets(mSheet).Range(mCell).Val ue
End Function

This lets me specify the worksheet, but what if I have/want to use
another workbook?

I presume wookbook is the VBAProject name from the Project window?

Thanks - Kirk



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Modify function for another workbook

On Thu, 20 Dec 2007 11:18:57 -0000, "Bob Phillips"
wrote:

No it is the book name

Workbooks("my other book.xls")

instead of activeWorkbook.

Pass it as a parameter like the rest.


Thanks Bob,

That worked a treat :-)

Cheers - Kirk
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
Modify search function Dinesh Excel Worksheet Functions 3 March 18th 09 02:26 AM
Modify Function to Return Value Connie Excel Programming 2 October 11th 06 10:37 AM
How do I Default a modify password for each workbook Sammy work New Users to Excel 1 December 8th 05 04:11 PM
Modify the default new workbook? Margot Excel Worksheet Functions 1 February 11th 05 12:03 AM
to modify cells from a function Pierre Laporte Excel Programming 1 July 10th 03 02:11 PM


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