X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Copy Of Existing Worksheet In Same Workbook Named By The Value In A Cell, Office 2013    
post Aug 22 2019, 03:35 PM

Posts: 2,043
Joined: 26-August 04

Hi all

I have a form I have made in excel and I want to keep a copy of it in the same workbook. I have tried using the below code, but if the name already exists I get an error. Additionally, when I create the new worksheet and save it, I need to paste just the values...keeping just a snapshot of the form. I hope this makes sense and would really appreciate any help you could provide.

Sub Copyrenameworksheet()
'Updateby Extendoffice 20160704
    Dim ws As Worksheet
    Set wh = Worksheets(ActiveSheet.Name)
    ActiveSheet.Copy After:=Worksheets(Sheets.Count)
    If wh.Range("S23").Value <> "" Then
    ActiveSheet.Name = wh.Range("S23").Value
    End If
End Sub



D. Williams
Go to the top of the page
post Aug 22 2019, 03:47 PM

Posts: 882
Joined: 25-January 16

Review https://www.UtterAccess.com/forum/index.php...2054830&hl=

Attachments Manager is below the edit post window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG! http://www.cpearson.com/Excel/DebuggingVBA.aspx
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    20th October 2019 - 09:35 AM