+ Reply to Thread
Results 1 to 3 of 3

Add vba to current macro to copy table into newly created sheet

  1. #1
    Registered User
    Join Date
    08-15-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    9

    Add vba to current macro to copy table into newly created sheet

    Hi

    I'm new to the forum, VERY new to using vba, but am experienced at using excel formula.

    I'm using a macro to create new sheets based upon a list.
    Sub Add_Tariffs()
    Set Rng = Range("B3:B20")
    For Each c In Rng
    Var1 = c
    On Error Resume Next
    If Worksheets(Var1).Name = "" Then
    Msg = "Worksheet named " & Var1 & " does not exist" & vbCrLf _
    & "Do you want to add it?"
    Ans = MsgBox(Msg, vbYesNo + vbQuestion, "Add Worksheet?")
    If Ans = vbYes Then
    Sheets.Add.Name = Var1
    End If

    End If
    Next c
    End Sub

    What I need to do is copy a table from a 'Summary' sheet, paste it into the newly created sheet delete the data and then move on to the next.

    If it's possible to include the newly created sheet in a calculation on the summary sheet too, that would be great, but I can write formula to pick that up.

    Many thanks

    Mark

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Add vba to current macro to copy table into newly created sheet

    after the Sheets.Add.Name line, add something like this?
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-15-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Add vba to current macro to copy table into newly created sheet

    Hi

    I tried something similar but it wouldn't work.

    Tried this and this wasn't working either...

    Will have a think.

    Thanks

    Mark

+ 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: 0
    Last Post: 07-16-2013, 01:20 PM
  2. [SOLVED] VBA copy values to newly created sheet problem
    By dusoo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-01-2013, 10:32 PM
  3. Excel 2010 arithmetic operations on newly macro created pivot table
    By love0126 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-07-2013, 02:08 PM
  4. Getting Macro to reference newly created sheet
    By creuther in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-27-2011, 01:04 AM
  5. How to copy to newly created sheet and save as PDF?
    By joanneb in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-30-2009, 04:05 PM

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