+ Reply to Thread
Results 1 to 12 of 12

Need to copy the data into new sheet with cell based file name.

  1. #1
    Forum Contributor
    Join Date
    10-16-2010
    Location
    bangalore
    MS-Off Ver
    Excel 2019
    Posts
    288

    Need to copy the data into new sheet with cell based file name.

    Hi Experts,

    Need to get the below result through VBA code based on the attached sample workbook.

    1. I need to copy the entire data from sheet1 into new sheet with paste special values without blanks.
    2. Sheet needs to be saved on the desktop irrespecive of any user with file name based on the sheet2 cell E1.

    Regards,
    Anwitha
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Need to copy the data into new sheet with cell based file name.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    10-16-2010
    Location
    bangalore
    MS-Off Ver
    Excel 2019
    Posts
    288

    Re: Need to copy the data into new sheet with cell based file name.

    Similaly above codes, I am applying with sheet25, with below codes and its not working. Any rason?


    Application.ScreenUpdating = False
    Worksheets.Add before:=Sheets("sheet2")
    With Sheets("Sheet25").UsedRange
    .AutoFilter 1, "<>"
    .Copy Sheets(Sheet25).Cells(1)
    .AutoFilter
    End With
    Sheets("sheet1").Copy
    With ActiveWorkbook
    .SaveAs CreateObject("WScript.Shell").SpecialFolders("DeskTop") & _
    "\" & ThisWorkbook.Sheets(Sheet25).[I7].Value & ".xlsx"
    .Close False
    End With
    Application.DisplayAlerts = False
    ThisWorkbook.Sheets("sheet1").Delete
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    End Sub

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Need to copy the data into new sheet with cell based file name.

    1) Don't change Sheets(1) in my code.
    2) replace "sheet1" withe the sheet name that you have oroginal data.
    3) replace Sheets("sheet2).[e1] with actual sheet name and cell address.
    Do not forget to add double quotes.
    Sending This from phone.

  5. #5
    Forum Contributor
    Join Date
    10-16-2010
    Location
    bangalore
    MS-Off Ver
    Excel 2019
    Posts
    288

    Re: Need to copy the data into new sheet with cell based file name.

    Oh....Thank you so much for your immediate response...Now its really working......Thanks a lot again...

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Need to copy the data into new sheet with cell based file name.

    You are welcome.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  7. #7
    Forum Contributor
    Join Date
    10-16-2010
    Location
    bangalore
    MS-Off Ver
    Excel 2019
    Posts
    288

    Re: Need to copy the data into new sheet with cell based file name.

    Hello Jindon,

    I have applied this code with new workbook but, the data is copying with formulas, i need it as values and range should be copied frm A to Z column

    here is the code i used. Please check and help.

    Please Login or Register  to view this content.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Need to copy the data into new sheet with cell based file name.

    Try add one line
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    10-16-2010
    Location
    bangalore
    MS-Off Ver
    Excel 2019
    Posts
    288

    Re: Need to copy the data into new sheet with cell based file name.

    added the above code, but still values are appearing with formulas..also as i said it need to copy the collumn A to Z only....now it is copying entire sheet.

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Need to copy the data into new sheet with cell based file name.

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

  11. #11
    Forum Contributor
    Join Date
    10-16-2010
    Location
    bangalore
    MS-Off Ver
    Excel 2019
    Posts
    288

    Re: Need to copy the data into new sheet with cell based file name.

    If i give the range as .Columns("a:z").Copy Sheets(1).Cells(1) then, column H&I comes as "00.01.1900" instead of actual dates.

    If i remove the above code, then it will copy entire sheet with all workings..

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Need to copy the data into new sheet with cell based file name.

    Upload a workbook that you are working with.

+ 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 row data from one sheet to another based on cell input
    By sludeking in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-17-2018, 12:48 PM
  2. [SOLVED] Copy Data to Sheets (Sheet name based on value from Cell)
    By Andrew.Trevayne in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-10-2017, 09:18 AM
  3. [SOLVED] Copy paste data one to multiple sheet based on cell value to sheet name
    By kannan1847 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-15-2015, 12:54 AM
  4. [SOLVED] Need to Copy cells data to a new sheet based on value of another cell
    By clintandcaden in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 09-14-2012, 05:28 PM
  5. [SOLVED] Macro to Copy Data from one Sheet A to Sheet B based on value in cell on sheet A
    By scass in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-11-2012, 07:21 PM
  6. Seach in folder and copy data from file based on sheet names in master workbook
    By Hassų in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-06-2012, 09:25 AM
  7. How to copy data from a sheet based on a cell value?
    By Bill Williams in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-27-2011, 01: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