+ Reply to Thread
Results 1 to 8 of 8

VB Question - Cell value from multi worksheets

  1. #1
    Registered User
    Join Date
    03-13-2007
    Posts
    4

    VB Question - Cell value from multi worksheets

    Hi All,

    I have a workbook with about twenty worksheets. Te last worksheet is a summary page were I would like to display and calculate information from the other worksheets. My problem is I can't figure out how to reference cells from the other worksheets. On the summary page I have a calc button with this code:

    Do While Range("B" & variable).value > ""

    Here is a couple of things i've tried:

    Do While Range("sheet1!B" & variable).value > ""
    Do While sheet1.Range("B" & variable).value >""

    Could someone tell me the right syntex or a better way to accomplish this.

    Thanks!

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    H3llB3nt

    Please read posting rules. Links to the rules are in Red & blue text below.
    Failure to follow the rules may see you message deleted.

    There are several ways to do this

    Please Login or Register  to view this content.

    All the above lines of code test a cells contents. This is not the most efficient way to loop through cells.

    For my view of Do & For type loops please see my last 2 replys at
    http://www.excelforum.com/showthread...=591910&page=2

    Without specifics of what you are trying to acheive I can only give general answers.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Registered User
    Join Date
    03-13-2007
    Posts
    4

    Reference cells from multi worksheets

    Sorry about missing the rules.

    Below I have the code I came up with so far. On the "Summary" worksheet I have a button with this code behind it. what I'm trying to do is check cells on the "Administration" worksheet and see what's in certain cells. I then want to take that info and place it back on the "Summary" worksheet.


    Please Login or Register  to view this content.
    Thanks for any help you can give me!

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    When testing the one cell for multiple answers it is more efficient to use Seelct Case that IF statements

    Select Case tests the cells contents once
    IF statements tests the cells contents for each IF and Elseif statement

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-13-2007
    Posts
    4
    Thanks for the reply Mudraker!

    The code still seems to bomb on the first line though. I don't think that's the right syntax to reference another cell in a different worksheet. Any thoughts?

    Thanks!

  6. #6
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    I think i mis read & did not fully understand your problem

    What is Administration!B & Administration!D supposed to refer to?

    The correct way to use range is
    Please Login or Register  to view this content.
    Instead of range("a1") you could also use
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-13-2007
    Posts
    4
    That's it Thanks mudraker! I swear I tried that

    Administration!D was refering to a cell in a different worksheet.

  8. #8
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Good to hear you have resolved your problem


    one thing I did not list

    to work with a named range or named cell on another sheet

    use

    Please Login or Register  to view this content.

+ 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