+ Reply to Thread
Results 1 to 2 of 2

Adding to a list.

  1. #1
    Registered User
    Join Date
    01-13-2005
    Posts
    2

    Unhappy Adding to a list.

    Hey everyone!

    I know most of you will regard this as simple, but im havin a hard time thinking about it.

    I've got a sheet with the following

    1_ProductCode__|__Style___|_Description__|_Quantity_|
    2___12345_____|_Hardback |___Plastic____|___10____|


    I need a seperate sheet where the user can type in a product code, Style, Description and Quantity and add it to the list. Really, i could also do with a bit of code to check that that product code isn't already being used.

    and, if possible, how would i let the user search on a code, and then be able to edit it's details, such as style and description? I've already got it changing quantities.. Any help people???

    Thanks in advance..

    Dave
    Last edited by bikecruiser; 01-15-2005 at 11:04 AM. Reason: Format the table properly

  2. #2
    Forum Contributor
    Join Date
    11-09-2004
    Posts
    451
    I am assuming that sheet1 is the main sheet and sheet2 is the sheet where you enter new productcode, which will insert productinfo into sheet1 if productcode is not present in sheet1 and update if it is present in sheet1.

    i am also assuming that

    a1 cell has value productcode, b1 has style,c1 has description, d1 has quantity in both the sheets.

    I want to back up your workbook before executing this macro



    Try this macro



    Sub Macro1()


    Dim i As Integer
    Dim k As Variant
    k = 2
    i = 0
    Dim wh As Variant

    Sheets("sheet2").Select
    While i = 0
    Sheets("sheet2").Select
    If (Range("a" & k).Value <> "") Then

    wh = Range("a" & k).Value
    Range("a" & k & ":d" & k).Select
    Selection.Copy

    Sheets("sheet1").Select
    On Error Resume Next
    Range("a:a").Select
    Selection.Find(What:=wh, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
    :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
    False).Activate
    If Err.Description <> "" Then
    Sheets("sheet1").Select
    Range("a1").Select
    Selection.End(xlDown).Select
    MsgBox ActiveCell.Address
    ActiveCell.Offset(1, 0).Select
    ActiveSheet.Paste
    Err.Clear
    Else
    Sheets("sheet1").Select
    ActiveCell.Select
    ActiveSheet.Paste
    End If

    Else
    i = 1
    End If

    k = k + 1
    Wend
    End Sub

+ 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