+ Reply to Thread
Results 1 to 9 of 9

VBA Multiply Function & Sub Procedure to Show Result

  1. #1
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    VBA Multiply Function & Sub Procedure to Show Result

    I have Created a Function to Multiply & a Sub to Show Result In MsgBox


    Please Login or Register  to view this content.
    It works fine when I State N1 as 132 & N2 as 456.

    However i want N1 & N2 to be extracted from the Worksheet named Prices in a Workbook Named "Basic Beginers Codes".

    Where N1 lies in Cell A2 & N2 Lies in Cell A3.

    What changes should I make to the code?
    Cheers!
    Deep Dave

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: VBA Multiply Function & Sub Procedure to Show Result

    Hi, Deep,

    Please Login or Register  to view this content.
    I assumed the extension for the workbook to be xlsm, alter if needed. If itīs the workbook with the code it may be referenced to as ThisWorkbook.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: VBA Multiply Function & Sub Procedure to Show Result

    I am unable to execute the code yet.

    Can you precisely tell me where to add the code?

    Or can you please state the whole code that i can copy?

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: VBA Multiply Function & Sub Procedure to Show Result

    Hi, Deep,

    replace
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.
    although I wonder why anybody would need an UDF for multiplying.

    Please Login or Register  to view this content.
    Ciao,
    Holger

  5. #5
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: VBA Multiply Function & Sub Procedure to Show Result

    Hey!!

    I replaced as Instructed, but it still isnt working -

    Below is the new code -
    Please Login or Register  to view this content.

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: VBA Multiply Function & Sub Procedure to Show Result

    Hi, Deep,

    but it still isnt working
    Workbook not open, code not started from the VBE by eiter F8 or F5, any error message, not in a normal module? If you post just that information itīs very hard to find the reason for the "not working".

    Ciao,
    Holger

  7. #7
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: VBA Multiply Function & Sub Procedure to Show Result

    @Holger

    I am attaching the Workbook for better understanding.
    Attached Files Attached Files

  8. #8
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: VBA Multiply Function & Sub Procedure to Show Result

    Hi, Deep,

    we humans can calculate and evaluate on Letters but if you advice Excel to work with Doubles there will be no match if you assign Letters unless you convert them to Doubles.

    Where N1 lies in Cell A2 & N2 Lies in Cell A3
    A2 is A, A3 is B, the prices are listed in Column B so you should change the code to reference Column B instead of A:
    Please Login or Register  to view this content.
    Ciao,
    Holger

  9. #9
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: VBA Multiply Function & Sub Procedure to Show Result

    Problem Solved!

    Thank You For the Help!

    Marking the thread as Solved!

+ 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