Results 1 to 25 of 25

Copy range of data within sheet and rename based on cell value paste values and format

Threaded View

  1. #1
    Registered User
    Join Date
    06-22-2020
    Location
    Sweden
    MS-Off Ver
    O365
    Posts
    33

    Copy range of data within sheet and rename based on cell value paste values and format

    Hello everybody. I'm new to the forum and would appreciate some help. I have a code which allows me to copy sheet and rename based on cell value:

    Private Sub CommandButton2_Click()
    Dim ws As Worksheet
    Set wh = Worksheets(ActiveSheet.Name)
    ActiveSheet.Copy After:=Worksheets(Sheets.Count)
    If wh.Range("C3").Value <> "" Then
    On Error Resume Next
    ActiveSheet.Name = wh.Range("C3").Value & ", " & wh.Range("C4").Value
    End If
    wh.Activate
    End Sub


    I'd like for it to only copy a specific range of data from the sheet and paste only values and format (not formulas) into the newly created sheet.

    In addition to that, if I'm trying to copy a sheet with the same name twice, I'm getting an error. Is there any possibility to add a number to the newly created sheet name in addition to the value/name (C3:C4 above) if there's already a sheet with the existing name?

    Also, for some reason, the text within my ActiveX-buttons increases in size when I click on them. Any idea why that is and how to fix it?

    Thanks in advance.
    Last edited by alansidman; 06-24-2020 at 05:22 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VB Code to copy and paste range to certain sheet based on cell Value
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-22-2019, 03:38 PM
  2. Replies: 2
    Last Post: 02-06-2016, 10:19 AM
  3. [SOLVED] Copy Paste a Range of Values from a Different Sheet Based on Value Entered in Cell
    By hamidxa in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-13-2015, 04:53 PM
  4. Copy paste and rename folder based on Cell values
    By BrettRogersUK in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-28-2014, 04:54 AM
  5. [SOLVED] Copy and Paste Range of Cells based on # of cell values in Column A
    By bwaite87 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-17-2014, 05:51 PM
  6. Replies: 3
    Last Post: 02-21-2013, 12:48 AM
  7. Finding a named range based on cell value and copy/paste to same sheet?
    By Simon Lloyd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2006, 06:25 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