+ Reply to Thread
Results 1 to 8 of 8

Multiply range of cells by set value

  1. #1
    Registered User
    Join Date
    02-07-2023
    Location
    US
    MS-Off Ver
    Microsoft 365
    Posts
    9

    Multiply range of cells by set value

    Hello-
    I'm trying to multiply a range of cells by a specific value with the result populating in the next column. I need the code to only calculate the formula if there is a number in my range (I have blank cells & cells with text that I don't want messed up). Ex. If A1 has a value, then multiply by .66 and input result in B1.

    I can have the value that each cell needs to be multiplied by in another cell or the value just in a formula. I have found many similar posts on this problem but can't seem to get the solutions to work 100% correctly for me. I'm very new to code/VBA/macros and am trying to self-teach myself- it's going great, clearly

    Thank you in advance!!!!
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Multiply range of cells by set value

    Would you not just use a formula?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-07-2023
    Location
    US
    MS-Off Ver
    Microsoft 365
    Posts
    9

    Re: Multiply range of cells by set value

    Are you asking about just using a formula instead of code? Or using that formula in a code? I can't just use a formula because if I paste it in my report it will erase my headers. My full report has over a hundred sections & I need to compute each one.
    Attachment 826920
    If you are referring to using that formula in a code- how would I incorporate that into a full code to pull the right range, loop & input cell?

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: Multiply range of cells by set value

    Why don't you just delete all the mid-flight headings, close up all the blank rows, and use Sub-totals (based on a change in column A) to get your total lines?

    That would take the edge off the VBA learning curve.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Multiply range of cells by set value

    Try this

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-07-2023
    Location
    US
    MS-Off Ver
    Microsoft 365
    Posts
    9

    Re: Multiply range of cells by set value

    That worked!!! Thank you so much!!! I might be pushing it with this - is there anyway to have the formula show in the cell vs just the value? Not a requirement- just curious.

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: Multiply range of cells by set value

    Maybe this:

    Please Login or Register  to view this content.

  8. #8
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Multiply range of cells by set value

    Please Login or Register  to view this content.
    Test Out the below codes, one selects numbers only and the other selects text only.

    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)

Similar Threads

  1. [SOLVED] multiply a range of cells and then subtract a percentage.
    By louis.vail in forum Excel General
    Replies: 7
    Last Post: 08-19-2015, 09:00 AM
  2. Multiply range of cells by a value with Command button
    By mcanfield in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-07-2015, 10:47 AM
  3. Multiply the cells based on date range
    By ntgobinath in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-06-2014, 10:27 AM
  4. Multiply cells of a row with a corresponding cell in a range of constants
    By triver525 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 12-17-2012, 06:30 PM
  5. [SOLVED] Multiply all cells in a range by 1000
    By rwinterton2002 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-07-2012, 06:06 PM
  6. [SOLVED] Would like one cell to both count and multiply a range of cells
    By golfer18 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-26-2006, 11:40 PM
  7. Multiply cells in range by corresponding factor
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2005, 07: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