+ Reply to Thread
Results 1 to 10 of 10

Macro to copy numbers & format table across different sheets

  1. #1
    Registered User
    Join Date
    01-06-2019
    Location
    Euro
    MS-Off Ver
    365
    Posts
    35

    Macro to copy numbers & format table across different sheets

    I`m trying to record 2 macros and I just cannot get output that I want

    First one - From Sheet 2 I need the values to be copied to their corresponding cells in sheet 1. Bear in mind cell E2 has formula =CONCATENATE(B3,"g")
    After the first items are copied the next one needs to be copied into the adjcent cell (So E2 (sheet1) to C2 (sheet 2) and so on). The entries for weight and name need to have cell filled in (any) off white colour.

    Untitled.png

    Second one - In sheet 1 I have the horizontal list that I`m copying across. This list has any number of items (Torch & screw for example). I need the sum for each row in the end column. Their may be 2,3,4 etc... number of items. They must be formatted white text with black filler exactly as the pic with "Totals" written in the bottom cell


    I posted here but seems like no one replied.
    https://www.mrexcel.com/board/thread...macro.1131219/
    Attached Files Attached Files
    Last edited by Longissimus; 04-21-2020 at 11:26 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: unable to get desired output from macro

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however the thread title does not really convey what your request is about. Tell us what you are trying to do, not how you think it should be done.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: unable to get desired output from macro

    Title the thread something like Copy values and format table. I have a solution available when you comply.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Registered User
    Join Date
    01-06-2019
    Location
    Euro
    MS-Off Ver
    365
    Posts
    35

    Re: unable to get desired output from macro

    Apologies. It was the best I was coming up with. I will adjust accordingly.

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macro to copy numbers & format table across different sheets

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-06-2019
    Location
    Euro
    MS-Off Ver
    365
    Posts
    35

    Re: Macro to copy numbers & format table across different sheets

    Thanks for posting.

    I`m getting this this runtime error 1004 - Application defined or object defined error
    at line

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    01-06-2019
    Location
    Euro
    MS-Off Ver
    365
    Posts
    35

    Re: Macro to copy numbers & format table across different sheets

    My sheets are actually named differently to the ones i mentioned here. I thought it would be a simple case of just changing the names in the code.
    I renamed the sheets in your excel file and code to match mine exactly and got the same error.

    Below is all the code, you will notice I changed what ws1 & ws2 are equal to, i thought that`s enough.

    Please Login or Register  to view this content.

  8. #8
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macro to copy numbers & format table across different sheets

    Did you try the example file uploaded in post #5 ?

    Is the table format on Sheet1 in the example file exactly the same as in your actual file e.g: Is the Weight in row 5?

    Is anything else different between your actual file and the one you posted in #1 ?

  9. #9
    Registered User
    Join Date
    01-06-2019
    Location
    Euro
    MS-Off Ver
    365
    Posts
    35

    Re: Macro to copy numbers & format table across different sheets

    Almost exactly same, the only thing different is it`s not weight, AVI etc... that are written but other things. Also I used your int he process.
    I note that in yours there are some macros with some instructions in the name such as 'Copy_current_sheet_into_a_new_sheet_then_save_new_sheet_as_new_workbook_then_delete_the_sheet_that_was_created' are you referring to these when you say 'try the example'?

    I noted that once i remove entries copied into the expanding horizontal list it break. In my workflow I will be constantly needing to start again from scratch as I will copy paste what I have to a word doc and start the process again.

  10. #10
    Registered User
    Join Date
    01-06-2019
    Location
    Euro
    MS-Off Ver
    365
    Posts
    35

    Re: Macro to copy numbers & format table across different sheets


+ 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] Unsure/unable how to formulate Covariance.P formula for desired cells
    By Coyote_e in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-14-2019, 08:29 PM
  2. [SOLVED] Creation of desired data (Output) from EDI file (Input)
    By RavindraK in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 12-26-2018, 04:37 AM
  3. Macro to get the total hours per week
    By mihaufo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-04-2014, 06:46 AM
  4. [SOLVED] Macro for blank cells and desired output
    By rajkumarmp in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-18-2013, 02:11 PM
  5. [SOLVED] Not getting desired output
    By mhtkhan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-09-2012, 01:09 AM
  6. macro not giving desired output
    By coolanks1 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-23-2009, 07:36 AM
  7. can I use circular Refference to get Desired Output?
    By gujjar in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-24-2008, 04:27 AM

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