+ Reply to Thread
Results 1 to 4 of 4

Macro to append string of cells into specific row and colum??

  1. #1
    Registered User
    Join Date
    02-13-2014
    Location
    Costa Rica
    MS-Off Ver
    Excel 2007
    Posts
    2

    Question Macro to append string of cells into specific row and colum??

    Hello experts,
    Im new to macros.
    Heres the question concerning the following tables:

    How do I tell excel to copy calculator!B4:B7, look at calcultator!b1 to find the value "2014-1", match it with masterdata!A2, and "special paste, transpose" the values to cell c2?

    Here's my dilemma. Im creating a document to calculate my family budget. I have a "masterdata" sheet and a "calculator" sheet.

    The masterdata sheet contains rows for month and columns for my income, expenses and savings. The expenses category contains 4 subcategories: Food, Utilities, Gasoline and Dining out. Looks something like this:

    TABLE "MASTERDATA"
    A B C D E F G
    1 Month income food util. gas Dining savings
    2 2014-1 $1000 200 100 50 75 500
    3 2014-2 $1300 250 100 150 200 300


    The calculator sheet grabs my income depending on the month selected and allows me to juggle the numbers and see how much do I have available. So, for instance, if I select 2014-1 , the "$$ available" cell fills with $1000.
    Then, I can input my expenses to try and stretch the money. The calculator looks like this:

    TABLE "CALCULATOR"

    A B
    1 Select month: 2014-1
    2 $$Available: $1000
    3 $$Remaining ($available minus expenses)
    4 food 200
    5 util 200
    6 gas 200
    7 dining 200
    So in this case, the cell b3 ($$remaining) would calculate a remaining $200.

    Here comes the question. I want to create a macro that grabs the values from the calculator and pastes them to the masterdata sheet, at the row for 2014-1 (or any other month selected in the calculator) and the column where the expenses are stored.

    Is this possible?

    How do I tell excel to copy calculator!B4:B7, look at calcultator!b1 to find the value "2014-1", match it with masterdata!A2, and "special paste, transpose" the values to cell c2?

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,830

    Re: Macro to append string of cells into specific row and colum??

    Try:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    02-13-2014
    Location
    Costa Rica
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Macro to append string of cells into specific row and colum??

    Hi Mumps1,

    Thank you for taking the time to provide a solution. Just a quick question. In this line:

    LastRow = Sheets("MASTERDATA").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row

    what does the asterisk mean ??

    Im going to try and use this formula with the real tables and see how it works. Thanks a bunch!

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,830

    Re: Macro to append string of cells into specific row and colum??

    The asterisk is a 'wildcard' that can stand for anything. The 'Find' looks in each cell in the sheet to see if it contains anything. It keeps searching until it finds the last cell with data. When it finds the last cells containing anything, the line of code stores the row number of that cell's row in the variable 'LastRow'. So if the last cell containing data in J550, then LastRow=550. I hope this helps.

+ 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. copy a range of cells N times and paste in separate sheet and also change a specific colum
    By maramkarthik in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-21-2013, 04:27 AM
  2. Append texts into one string from 4 cells that each cell has a formula
    By Rocky2013 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-28-2013, 09:57 AM
  3. [SOLVED] Macro for finding out specific row and printing JD in the adjacent colum
    By meezadahsra in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-03-2013, 06:28 AM
  4. copy and paste colum K to colom R and skip filled cells colum R
    By jdrmer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-13-2012, 10:30 AM
  5. Compare a string in two columns, if match then append string from third column
    By Londonderry in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-22-2007, 03:41 PM

Tags for this Thread

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