+ Reply to Thread
Results 1 to 13 of 13

Excel VBA Multiply

  1. #1
    Registered User
    Join Date
    02-25-2016
    Location
    U.A.E
    MS-Off Ver
    2010
    Posts
    7

    Excel VBA Multiply

    Dears,
    First of all. This is an awesome forum and I have been learning from this from long time.

    I have a question.
    I have cell range which are linked to external excel file and containing different numbers in various currency. Cell Range ( A1:A30)
    I have a currency range with which I want to convert the above range and conversion rate is given in B1
    and I am applying the following code.

    Please Login or Register  to view this content.
    It works perfectly fine however after multiplying it is removing the links of external file and giving me hard figures.
    Is it possible If I can modify the above code and keep the external links * figure in B1 and get a product?

    Regards,
    N
    Last edited by JBeaucaire; 03-12-2016 at 02:02 PM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,052

    Re: Excel VBA Multiply

    Hi, welcome to the forum

    Why do you need VBA for this? Do you intend to replace the existing values? If not, you could probably use a regular formula to do this
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Excel VBA Multiply

    You would need to change the column A "links" to a larger formula. For instance, if the link in A1 reads;
    =Sheet5!A1

    ...change that to:
    =Sheet5!A1 * B1
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    02-25-2016
    Location
    U.A.E
    MS-Off Ver
    2010
    Posts
    7

    Re: Excel VBA Multiply

    Hi, Actually I have number of Sheets and number of different Currencies. I have linked range from A1:A30 to external work books from where I am pulling out the info. But in master sheet I need to convert them with different values. So I am working on a solution where I can just run a macro. It is working fine but I want to retain external links also so that I can always go back and check the original value. Can you help?

  5. #5
    Registered User
    Join Date
    02-25-2016
    Location
    U.A.E
    MS-Off Ver
    2010
    Posts
    7

    Re: Excel VBA Multiply

    Can you elaborate further? I did not understand or maybe I was unable to explain it to you.
    A1:A30 is the range which is going to be multiplied with B1
    And A1:A30 has values from external file.
    So as per above code it is converting accurately but removing the links to external files but i want to retain those links plus it gets multiplied with value in B1.
    Pls advise if you can solve. I know I am very close but not an expert.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Excel VBA Multiply

    My suggestion above stands.

    I wouldn't recommend trying to change the linked cells themselves. There's no need to do that, they are your "source" references and should be left alone, in my opinion. You have tons of free space on your worksheet, so I would create my final "summary" in other cells referencing those source cells.

    =A1 * B1
    =A2 * B1
    .etc...



    This way any edits to B1 would instantly update your summary results with no VBA.

  7. #7
    Registered User
    Join Date
    02-25-2016
    Location
    U.A.E
    MS-Off Ver
    2010
    Posts
    7

    Re: Excel VBA Multiply

    Yeah that I know a simple solution. But I want to have it VBA and there are certain reasons. My template is completed with the above code where I only run the above code and copy paste the links. But if the above problem can be resolve by changing anything in the code. my project will be completed.
    Do let me know if anyone can help.

  8. #8
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Excel VBA Multiply

    try some basic approach..

    Something like..

    Please Login or Register  to view this content.
    Regards!
    =DEC2HEX(3563)

    If you like someone's answer, click the star to give them a reputation point for that answer...

  9. #9
    Registered User
    Join Date
    02-25-2016
    Location
    U.A.E
    MS-Off Ver
    2010
    Posts
    7

    Re: Excel VBA Multiply

    Dear Roy,
    I tried this but this is giving an error. Can you pls check if possible and thanks for giving valuable suggestion.

  10. #10
    Registered User
    Join Date
    02-25-2016
    Location
    U.A.E
    MS-Off Ver
    2010
    Posts
    7

    Re: Excel VBA Multiply

    Dear Roy Thanks for giving direction. I had to modify it slightly and it is working fine now. Thanks alot

  11. #11
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Excel VBA Multiply

    The solution from Debraj Roy doesn't remove the original links as well?

  12. #12
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Excel VBA Multiply

    Hi JB..

    Excel native paste special function has a special ability.. to preserve .FORMULA and then Concat the Multiply with the Old one..
    If original value is FORMULA then it concat else it HardCoded Multiply the VALUE..

  13. #13
    Registered User
    Join Date
    02-25-2016
    Location
    U.A.E
    MS-Off Ver
    2010
    Posts
    7

    Re: Excel VBA Multiply

    Hi Roy,
    Another help if you can do. The code you provided was working fine till the time multiplied value is a number itself.
    But when I am pulling it after using Vlookup or sumif formula.
    It then multiplies with Text rather than number which has been pulled out after applying the formula.
    Any quick Fix?

    Regards,
    N

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Need to multiply a VLOOKUP value then divide that value, then multiply that value
    By debbiemez in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-27-2015, 04:57 PM
  2. Multiply in Excel
    By jheneko in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-23-2014, 04:35 PM
  3. Replies: 4
    Last Post: 01-10-2014, 09:32 AM
  4. If criteria match, multiply then sum across multiply worksheets
    By ciayers in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-09-2013, 02:20 PM
  5. [SOLVED] Multiply, Divide and Then Multiply in a cell
    By Brownie2576 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-22-2012, 08:57 PM
  6. Excel macro to multiply by same value
    By Recycler29 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-12-2005, 07:05 AM
  7. How do I multiply matrices in Excel?
    By matrices in excel in forum Excel General
    Replies: 2
    Last Post: 03-05-2005, 02:06 PM

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