+ Reply to Thread
Results 1 to 6 of 6

Macro to: Create New Sheet, Copy and Paste Into New Sheet

  1. #1
    Registered User
    Join Date
    06-14-2013
    Location
    US
    MS-Off Ver
    Excel 2011
    Posts
    8

    Macro to: Create New Sheet, Copy and Paste Into New Sheet

    Hi,

    I'm new to VBA (excel 2011) and working on an "auto-mated" spread sheet for my boss. My boss knows less about excel than I do, so I'm trying to make it as hands off as possible. To this end, I've been working on macros so she just has to push one button for the desired results. I have two needs,

    The macro in mind:
    I want to have it:
    create a new sheet
    name the sheet based on Cell Name (A1)
    copy cells A1:Q211
    Paste them into New Sheet

    Another thing I need is a macro to make a summary sheet of all sheets past the summary sheet. I know theres a macro template already out there, but the link to that site appears to be broken. Any help in getting started on that would be great.

    Thanks all, you are the best!
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    05-09-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    259

    Re: Macro to: Create New Sheet, Copy and Paste Into New Sheet

    Hi, sorry but i'm a little confused on the copy cells A1:Q211? Brain freeze sorry
    Last edited by Hurricanefly; 06-28-2013 at 02:00 PM. Reason: Being Dumb,Sorry

  3. #3
    Registered User
    Join Date
    06-14-2013
    Location
    US
    MS-Off Ver
    Excel 2011
    Posts
    8

    Re: Macro to: Create New Sheet, Copy and Paste Into New Sheet

    No worries, you are doing me a service. I can't get mad at that.

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

    Re: Macro to: Create New Sheet, Copy and Paste Into New Sheet

    Hi

    I think that there are several mistakes on your spreadsheet

    For example you cannot add " Quantity In Stock " levels together, this should be reducing.

    However I will create something for you.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    06-14-2013
    Location
    US
    MS-Off Ver
    Excel 2011
    Posts
    8

    Re: Macro to: Create New Sheet, Copy and Paste Into New Sheet

    Curious, won't the path be to the specific sheet then to the table column, eliminating any issues?

  6. #6
    Registered User
    Join Date
    06-14-2013
    Location
    US
    MS-Off Ver
    Excel 2011
    Posts
    8

    Re: Macro to: Create New Sheet, Copy and Paste Into New Sheet

    I was able to find a solution/macro to my problem. Thanks for your work guys!
    PHP Code: 
    Sub Add()


    Dim wsName As VariantwsInvalid As String
    Dim ws 
    As WorksheetwsArray As VariantAs Integer
    wsArray 
    = Array("[""]""/""\", "?", ":")
    GetName:
    wsName = Application.InputBox("
    Please enter the day's date." & vbCrLf & wsInvalid, , , , , , , 2)
    If wsName = False Or wsName = vbNullString Then Exit Sub

    For i = LBound(wsArray) To UBound(wsArray)
        wsName = Replace(wsName, wsArray(i), "")
    Next
    If Len(wsName) > 31 Then wsName = Left(wsName, 31)

    On Error Resume Next
    Set ws = Sheets(wsName)
    On Error GoTo 0

    If Not ws Is Nothing Then
        Set ws = Nothing
        wsInvalid = "The worksheet " & wsName & " already exists!"
        GoTo GetName
    Else
        Sheets("Update Sheet").Copy after:=Sheets(ActiveSheet.Name)
        ActiveSheet.Name = wsName
    End If

    End Sub 

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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