+ Reply to Thread
Results 1 to 5 of 5

Creating a Catalog from a list

  1. #1
    Registered User
    Join Date
    11-29-2005
    Posts
    12

    Creating a Catalog from a list

    I need to create a product catalog from a price list. The list contains a series of products of different labels from different manufacturers. When the "Create" button is pressed in the price list, a sheet should be created for each manufacturer with the product details re-arranged as per the template.
    Pl. see the attached sample

    Note : The list is not sorted on any order.

    I tried with some sample codes, but wasnt able to do it ultimately...Any help would be greatly appreciated.

    Best Regards,
    Karthik
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Auto Add sheets and naming them

    Hi,
    You should try to restrain from using merged cells because of its limits.


    Place this code in the workbook module, when you start entering manufactures names in column c of sheet list a new sheet will be added and then the range from the template will be copied to the new sheet but probable won't have the same formats be cause of the merged cells.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-29-2005
    Posts
    12
    Dear Dave,
    Thanks for your quick reply !
    But unfortunately this would not help me since the method you suggested do not support deletion of records from the "list" sheet.
    And also I will copy and paste the records from other files too. So I need something...that on the press of a button, the sheets are created/deleted.

    Thanks anyway !

    Best regards,
    Karthik

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Check to see if sheet exists then add sheet(delete sheet)

    Here are two codes that could work, you could then edit them to copy the ranges

    These two codes will search the workbook to see if a sheet name matches the active cell, if not it will add the sheet or delete it

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-29-2005
    Posts
    12
    Dear Dave,
    Thank you so much for the code. I am now able to create sheets with the manufacturer name as the name of the sheet and also delete the sheet. Using your code as the base, I just wrote the following code.

    Private Sub CreateSheet_Click()
    Dim ws As Worksheet
    Dim newSheetName As String
    Dim headerCell As Range
    Dim WSmain As Worksheet
    Dim Cnt As Long, Present As Long

    Set WSmain = ActiveSheet
    Cnt = 3
    Present = 0

    Do
    newSheetName = WSmain.Cells(Cnt, "C").Value

    For Each ws In Worksheets
    If ws.Name = newSheetName Or IsNumeric(newSheetName) Then
    Present = 1
    Exit For
    End If
    Next

    If Present = 0 Then
    Sheets.Add Type:="Worksheet"

    With ActiveSheet
    .Move after:=Worksheets(Worksheets.Count)
    .Name = newSheetName
    End With
    End If

    Present = 0
    Cnt = Cnt + 1

    Loop Until WSmain.Cells(Cnt, "C").Value = ""
    WSmain.Select
    Range("a1").Select
    End Sub

    Private Sub DeleteSheet_Click()
    For Each Sh In Worksheets
    If Sh.Name <> "List" Then
    If Sh.Name <> "Template(Manufacturer Name)" Then
    Application.DisplayAlerts = False
    Sh.Delete
    End If
    End If
    Next
    End Sub

    Thanks so much for your help !!

    My next step is to create the catalog in each sheet as per the template !

    Best Regards,
    Karthik

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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