+ Reply to Thread
Results 1 to 6 of 6

Macro to change number to number in another cell

  1. #1
    Forum Contributor
    Join Date
    10-03-2016
    Location
    Sydney, Australia
    MS-Off Ver
    MS 365
    Posts
    128

    Macro to change number to number in another cell

    Hi there,

    I'm trying to keep track of my monthly expenses and trying to make a more easier way to deal with it.

    The cost of the items go down Column B.

    From Column C to Column N I have the months.

    Is there a macro that if I enter "1" into the cell, the cost amount in Column B automatically appears?

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro to change number to number in another cell

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Contributor
    Join Date
    10-03-2016
    Location
    Sydney, Australia
    MS-Off Ver
    MS 365
    Posts
    128

    Re: Macro to change number to number in another cell

    Thanks,

    I've attached an example file.

    The unit cost is in Column B as mentioned.

    From Column C across to Column N, I want to enter a number (i.e. "1", "2", "3", etc) and this number will then multiply by the unit cost on the same row:

    Row 4:
    Exp1 has a unit cost of $5.00.
    I enter the number "1" in the January column, result is 1X$5.00 = $5.00
    I enter the number "2" in the January column, result is 2X$5.00 = $10.00
    I enter the number "3" in the January column, result is 3X$5.00 = $15.00

    I would like a macro to do these sums, so all I need to do is type "1", "2", "3", etc into the cell, the macro will then calculate the multiplication and automatically change the number:

    "1" will automatically change to $5.00
    "2" will automatically change to $10.00
    "3" will automatically change to $15.00

    Hopefully this makes sense and hopefully this is possible to do. I know I can do a normal formula like "=SUM(1X5.00)" and have the cells formatted to currency, but I would prefer to simplify the process with a macro if possible.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    10-03-2016
    Location
    Sydney, Australia
    MS-Off Ver
    MS 365
    Posts
    128

    Re: Macro to change number to number in another cell

    Sorry, if not already obvious, I didn't edit the example:

    I enter the number "1" in the January column, result is 1X$5.00 = $5.00
    I enter the number "2" in the September column, result is 2X$5.00 = $10.00
    I enter the number "3" in the December column, result is 3X$5.00 = $15.00

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro to change number to number in another cell

    That now makes sense.

    It is also quite easy.

    Right Click on your sheet name at the bottom of excel and select view code.

    Paste this code in the window that opens and close the window.

    Please Login or Register  to view this content.
    Last edited by mehmetcik; 03-07-2017 at 08:21 PM.

  6. #6
    Forum Contributor
    Join Date
    10-03-2016
    Location
    Sydney, Australia
    MS-Off Ver
    MS 365
    Posts
    128

    Re: Macro to change number to number in another cell

    That's perfect! Thanks Mehmetcik

+ 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. Replies: 10
    Last Post: 10-21-2015, 09:06 PM
  2. [SOLVED] Varying number in one cell, to change to a set number in another
    By Geoffo123 in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 12-11-2012, 08:36 PM
  3. [SOLVED] Excel VBA/Macro - Copy Number of Rows based on the number in a cell to another sheet
    By diane.alexander58 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-15-2012, 11:32 AM
  4. Identify Row Number based on Value in a cell and use that Row number in a Macro
    By johnnywinter in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-28-2009, 06:02 PM
  5. Replies: 7
    Last Post: 12-18-2008, 07:34 PM
  6. Macro to change number format of cell values
    By Sean Anderson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-11-2007, 12:24 AM
  7. [SOLVED] change cell shading when a number differs from the previous number
    By zooeyhallne in forum Excel General
    Replies: 1
    Last Post: 06-06-2005, 06:05 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