Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Filling a cell for Data Entry

  1. #1
    New Member
    Join Date
    Apr 2002
    Location
    Milwaukee
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have a spreadsheet where I have approx. 50 product codes. When I select a product code, I want Excel to fill in the cost (from a list on a separate sheet) in the cell next to the product code. In the past I've used nested "IF" statements, but I have what appears to be more ifs than exel can handle.

    Thanks for the help

  2. #2
    Board Regular Brian from Maui's Avatar
    Join Date
    Feb 2002
    Posts
    8,450
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try using VLOOKUP where
    Column A has your product code
    Column B your cost adjacent to the product code.

    =vlookup(C1,range,2)

    Where C1 is where you enter your product code

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Huntington Beach, CA USA
    Posts
    327
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi BassBone,

    If you want to do this with vba:

    Option Explicit
    Private Sub Worksheet_Change(ByVal Target As _ Excel.Range)
    Dim Code As Integer

    If Target.Cells.Count > 1 Then End
    If Target.Row >= 4 Then
    If Target.Column = 2 Then
    code = Target
    Application.EnableEvents = True
    Sheets("Sheet2").Range("B5").Offset(code, 0) - Resize(1, .Copy _ Destination:=Target.Offset(0, 1)
    Target.Offset(1, 0).Activate
    End If
    End If
    Application.EnableEvents = True
    End Sub

    James

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •