Using a value within cell as range in macro (Sorry to ask ag
Eliminate Pivot Table Annoyances
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 8 of 8

Thread: Using a value within cell as range in macro (Sorry to ask ag

  1. #1
    New Member
    Join Date
    Apr 2002
    Location
    England
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    Alright. A simple version of what i want is this...

    I have a value (money) in cell A1 and i want it to be added to cell A2. The thing is i want the macro to look at the value in B1 (which is A2) to direct it to A2.

    This is a simplified version of what i want but if you could explain it to me using this it would realy realy help a lot.

  2. #2
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    The following formula will work:

    =A1+INDIRECT(B1)

    It isn't VB though. This formula adds A1 to the A2 if the text "A2" is in cell B1.
    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

  3. #3
    New Member
    Join Date
    Apr 2002
    Location
    England
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    thanks, but what i need is for it to run through a macro. Its for an order form you see. And when an order is processed i intend to add this so that it will add a value to another when the order is processed.

    if anyone can help further... please do!

  4. #4
    Board Regular
    Join Date
    Feb 2002
    Location
    Guderup, Denmark
    Posts
    288
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    This piece of takes the value of A1 and places it in the cell that is written in B1

    Sub test200()
    Range([b1].Text).Value = range([b1].test).value+ [a1].Value
    End Sub

    regards Tommy

    [ This Message was edited by: Tommy Bak on 2002-04-09 06:55 ]

  5. #5
    New Member
    Join Date
    Apr 2002
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    using VB it would be something like:

    myMoney=range("A1")+range(range("B1"))

  6. #6
    New Member
    Join Date
    Apr 2002
    Location
    England
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    ok, i'll try it out. thanks

  7. #7
    Board Regular
    Join Date
    Feb 2002
    Location
    Perth Australia
    Posts
    1,579
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default


    Hi there

    Try this bit of code:

    Range(Range("B1").Value).Value =Range(Range("B1").Value).Value + Range("A1").Value

    regards
    Derek

  8. #8
    New Member
    Join Date
    Apr 2002
    Location
    England
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    ok, thanks guys. this is a great board. i think i have it solved. if not, i will be back. but THANKS to everyone who replied an helped out.

    No doubt i will be back soon.

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com