+ Reply to Thread
Results 1 to 11 of 11

Copy Specific Cells and produce new output sheet

  1. #1
    Registered User
    Join Date
    08-04-2009
    Location
    Oxford, England
    MS-Off Ver
    Excel 2010
    Posts
    47

    Copy Specific Cells and produce new output sheet

    Hi Everyone

    I want to create a macro that will select a certain range of cells (for example column E to Column G) in one workbook then copy and paste them into a new workbook which I can then save separately and use an an upload file for an external system,

    Reason being is that the first workbook has several columns with formula in that I don't want uploading into the external system so a fresh workbook is required

    Thanks in advance

    Dan

  2. #2
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Copy Specific Cells and produce new output sheet

    try.
    Please Login or Register  to view this content.
    "No xadrez nem sempre a menor dist?ncia entre dois pontos ? uma linha reta" G. Kasparov.

    If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select b from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

  3. #3
    Registered User
    Join Date
    08-04-2009
    Location
    Oxford, England
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Copy Specific Cells and produce new output sheet

    Hi Marreco

    Thanks for the response

    I've tried the Macro but I think there is a piece missing for pasting the values from column G into the new file

    I'll try and add it myself but would appreciate your help again if you could add that part in

    Thanks

  4. #4
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Copy Specific Cells and produce new output sheet

    Try.
    Please Login or Register  to view this content.
    look for file named SheetForCopy

  5. #5
    Registered User
    Join Date
    08-04-2009
    Location
    Oxford, England
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Copy Specific Cells and produce new output sheet

    Hi Marreco

    The first one nearly works fine.. It just needs to paste the copied range from G1:G1000 to the new saved file

    Is it possibly missing a ActiveSheet.Paste function somewhere to paste the data in?

    Thanks for your help

    Dan

  6. #6
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Copy Specific Cells and produce new output sheet

    Hi
    try change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    08-04-2009
    Location
    Oxford, England
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Copy Specific Cells and produce new output sheet

    Sorry Marreco

    I meant this one.. It opens the prompt, let's you name the file, saves the file but does not copy any data

    Could you tell me what's missing from this one as it suits what I need much better

    Thanks again

    Dan

    Sub marreco_1048069()

    Dim strFileName As String

    strFileName = InputBox("Type a name for the new workbok", "File Name")
    If Trim(strFileName) = vbNullString Then Exit Sub

    ActiveSheet.Range("G1:G1000").Copy Sheets.Add.Range("A1")
    ActiveSheet.UsedRange.EntireColumn.AutoFit
    ActiveSheet.Move
    ActiveWorkbook.SaveAs "C:\MyFile\" & strFileName & ".xls", xlNormal
    ActiveWorkbook.Close False

  8. #8
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Copy Specific Cells and produce new output sheet

    you have to point to the correct directory
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    i haven't error in my test?

  9. #9
    Registered User
    Join Date
    08-04-2009
    Location
    Oxford, England
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Copy Specific Cells and produce new output sheet

    Apologies for the confusion as I am not that proficient with VBA yet

    What I mean is that in the new saved file there is no data copied from column G

    For example if I have in G1 "APPLE" then G2 "PEAR" then use the macro to save the new workbook none of those values appear in the new workbook

    I have already changed the save file path to my desktop so I can see the file but it is empty

    Thanks again

    Dan

  10. #10
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Copy Specific Cells and produce new output sheet

    try...
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    08-04-2009
    Location
    Oxford, England
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Copy Specific Cells and produce new output sheet

    Hi Marreco

    This copies the entire worksheet to a new workbook and isn't quite what I'm looking for but I will work with the examples you have given me to try and come up with a solution

    Thank you for your help on this

    Dan

+ 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: 5
    Last Post: 12-12-2013, 02:53 PM
  2. [SOLVED] Extract specific data from a report and re-produce cleaner output
    By SVTF in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 09-22-2013, 11:59 PM
  3. HELP! Macro to Copy specific cells from one sheet to another based on specific criteria
    By atriscritti in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-11-2012, 11:05 AM
  4. Copy visible cells and then transfer output to another sheet.
    By jram in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-03-2012, 01:42 PM
  5. Looping through columns to copy output into other sheet, and saving output
    By eludlow in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-08-2009, 06: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