+ Reply to Thread
Results 1 to 2 of 2

VBA to duplicate formatting/formula from one worksheet

  1. #1
    Registered User
    Join Date
    07-05-2021
    Location
    Toronto, Canada
    MS-Off Ver
    Microsoft Office 2016
    Posts
    1

    VBA to duplicate formatting/formula from one worksheet

    Hello there, first time poster.

    I have managed to use the following VBA to create multiple worksheets from a selection of names on a worksheet and then rename the new worksheets based on the selection of names, but I need the formatting/formula from the original worksheet to be on each newly created worksheet. This is the VBA is used:

    Sub AddWorksheetsFromSelection()
    Dim CurSheet As Worksheet
    Dim Source As Range
    Dim c As Range

    Set CurSheet = ActiveSheet
    Set Source = Selection.Cells
    Application.ScreenUpdating = False

    For Each c In Source
    sName = Trim(c.Text)
    If Len(sName) > 0 Then
    Worksheets.Add After:=Worksheets(Worksheets.Count)
    ActiveSheet.Name = sName
    End If
    Next c

    CurSheet.Activate
    Application.ScreenUpdating = True
    End Sub


    I tired simply inserting Sheets("Sheet1").Range("A1:B10").Copy Destination:=Sheets("Sheet2").Range("E1") but it's not working. I may not be putting it in the right place?
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,550

    Re: VBA to duplicate formatting/formula from one worksheet

    Please edit your post and put VBA code in tags
    Please Login or Register  to view this content.
    Artik

+ 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: 10-12-2020, 05:51 PM
  2. [SOLVED] Duplicate value formula to be used in conditional formatting
    By Keibri in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-15-2020, 11:37 AM
  3. Replies: 4
    Last Post: 01-28-2014, 03:57 AM
  4. Replies: 5
    Last Post: 10-29-2013, 04:42 PM
  5. Replies: 2
    Last Post: 03-01-2013, 11:37 AM
  6. [SOLVED] Conditional formatting of duplicate rows (not duplicate cells)
    By ExcelStefan in forum Excel General
    Replies: 2
    Last Post: 06-19-2012, 06:09 AM
  7. Replies: 7
    Last Post: 07-30-2008, 12:45 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