+ Reply to Thread
Results 1 to 3 of 3

Adding Cells in two different Workbooks

  1. #1
    Forum Contributor
    Join Date
    10-23-2003
    Posts
    141

    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!

  2. #2
    Tom Ogilvy
    Guest

    Re: 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" <STEVEB.1y8jna_1131549604.3274@excelforum-nospam.com> wrote in
    message news:STEVEB.1y8jna_1131549604.3274@excelforum-nospam.com...
    >
    > 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. #3
    Forum Contributor
    Join Date
    10-23-2003
    Posts
    141
    Thanks Tom!

    Everything worked great! I really appreciate your help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1