1. Welcome to Chandoo.org Forums. Short message for you

    Hi Guest,

    Thanks for joining Chandoo.org forums. We are here to make you awesome in Excel. Before you post your first question, please read this short introduction guide. When posting or responding to questions please remember our values at Chandoo.org are: Humility, Passion, Fun, Awesomeness, Simplicity, Sharing Remember that we have people here for whom English is not there first language and we need to allow for this in our dealings.

    Yours,
    Chandoo
  2. Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  3. When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

copy to another workbook based on cell value

Discussion in 'VBA Macros' started by kingcashandcarry, Dec 6, 2017 at 9:41 AM.

  1. kingcashandcarry

    kingcashandcarry New Member

    Messages:
    3
    i have a workbook (wb1)with several sheets. copy the active sheet to another workbook that is stored in folder z:\catalogue in xlsm forms but the filename will be the same as a cell value (ah33) in active sheet after the copied sheet will be renamed as sheet +1. if there is a sheet name sheet1 so the copied sheet will be renamed as sheet2
  2. bobhc

    bobhc Excel Ninja

    Messages:
    3,368
  3. kingcashandcarry

    kingcashandcarry New Member

    Messages:
    3
    my apologies about my thread yesterday
    i am writing again what i want to do.
    wb1 sheet1 copy and paste to workbook store in z:\catalogue in xlsm form
    but the filename of it is in wb1 sheet1 cell ah2,
    but the copied sheet will be paste and renamed if there is previous a sheet called sheet1 then the sheet will be renamed as sheet2 etg.
    upto now i have these 3 codes,
    trying to combine them

    [Sub open_category()


    Dim wkbkSource As Workbook

    Dim strPath As String

    strPath = "Z:\catalogue\"

    Set wkbkSource = Workbooks.Open(strPath & Range("ah2").Value & ".xlsm")

    End Sub]

    [Sub ChangeWorkSheetName()
    'Updateby20140624
    Dim Rng As Range
    Dim WorkRng As Range
    On Error Resume Next
    xTitleId = "KutoolsforExcel"
    newName = Application.InputBox("Name", xTitleId, "", Type:=2)
    For i = 1 To Application.Sheets.Count
    Application.Sheets(i).Name = newName & i
    Next
    End Sub]

    [Sub Macro1()
    '
    ' Macro1 Macro
    '

    '
    Sheets("sheet1").Select
    Sheets("sheet1").Copy Before:=Workbooks("BAZAAR.xlsm").Sheets(1)
    End Sub]

Share This Page