Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding Cells in two different Workbooks


Hi,

Does anyone have suggestions for the following:

The following code works great for adding the value of Cell A2 Sheet 2
to the last cell in column B Sheet 1.


Sub test()
Sheets("sheet2").Range("A2").Value = Sheets("sheet2").Range("A2").Value
+ _
Sheets("Sheet1").Range("B" & Rows.Count).End(xlUp).Value
End Sub

I would like to add the last cell in Column B Sheet 1 in Workbook 1 to
the value of cell A2 sheet1 in Workbook 2.

Basically the same formula but adding cells from different
spreadsheets.

Any help would be greatly appreciated!


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile: http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=483518

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Adding Cells in two different Workbooks

Sub test()
Dim bk1 as Workbook, bk2 as Workbook
Set bk1 = Workbooks("Workbook 1.xls")
set bk2 = Workbooks("Workbook 2.xls")
bk2.Sheets("sheet1").Range("A2").Value = _
bk2.Sheets("sheet1").Range("A2").Value + _
bk1.Sheets("Sheet1").Range("B" & Rows.Count).End(xlUp).Value
End Sub

both workbooks would need to be open.

--
Regards,
Tom Ogilvy



"STEVEB" wrote in
message ...

Hi,

Does anyone have suggestions for the following:

The following code works great for adding the value of Cell A2 Sheet 2
to the last cell in column B Sheet 1.


Sub test()
Sheets("sheet2").Range("A2").Value = Sheets("sheet2").Range("A2").Value
+ _
Sheets("Sheet1").Range("B" & Rows.Count).End(xlUp).Value
End Sub

I would like to add the last cell in Column B Sheet 1 in Workbook 1 to
the value of cell A2 sheet1 in Workbook 2.

Basically the same formula but adding cells from different
spreadsheets.

Any help would be greatly appreciated!


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile:

http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=483518



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding Cells in two different Workbooks


Thanks Tom!

Everything worked great! I really appreciate your help

--
STEVE
-----------------------------------------------------------------------
STEVEB's Profile: http://www.excelforum.com/member.php...nfo&userid=187
View this thread: http://www.excelforum.com/showthread.php?threadid=48351

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
Adding like cells from different workbooks Mr B[_2_] Excel Worksheet Functions 1 January 22nd 09 10:25 PM
Adding data from different workbooks Bev Excel Worksheet Functions 3 January 8th 09 09:07 PM
adding certain cells in multiple worksheets in multiple workbooks Stephen via OfficeKB.com Excel Worksheet Functions 1 February 4th 05 08:31 PM
Adding cells from multiple workbooks Blackcat Excel Discussion (Misc queries) 6 January 19th 05 09:50 AM
adding cells of workbooks not yet created terry freedman Excel Programming 5 November 22nd 04 03:09 PM


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