+ Reply to Thread
Results 1 to 5 of 5

Error in routing the values from one sheet to another

  1. #1
    Forum Contributor
    Join Date
    08-02-2015
    Location
    Hyderabad
    MS-Off Ver
    2007
    Posts
    160

    Error in routing the values from one sheet to another

    Dear All,

    I couldn't able to guess the error in the code shown below

    My Requirement is to route the quantity entered in Shet "Receipts UF" by selecting the Item & its dependent Model & particular date in which Inward of a particular model is done.

    Attached the file for your reference.

    PHP Code: 
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If 
    Target.Address "$E$9" Then
        Dim item 
    As Longws2 As Worksheetws1 As Worksheetitem2 As Stringitem3 As String
        
        Set ws1 
    Sheets("Receipts UF")
        
        
    item ws1.Range("E2").Value
        item2 
    ws1.Range("E6").Value
        
        item3 
    Sheets("Receipts UF").Range("E4").Value
        Set ws2 
    Sheets(item3)
        If 
    item3 "Production" Then
            r 
    Application.Index(ws2.Range("A1""BK81"), Application.Match(item2ws2.Range("A:A"), 0), Application.Match(itemws2.Range("A1:BK1"), 0)).Address
        End 
    If
        If 
    item3 <> "Production" Then
            r 
    Application.Index(ws2.Range("A1""BK81"), Application.Match(item2ws2.Range("A:A"), 0), Application.Match(itemws2.Range("A1:BK1"), 0) + 1).Address
        End 
    If
        
    ws2.Range(r).Value ws2.Range(r).Value ws1.Range("E8").Value
        MsgBox ws1
    .Range("E8").Value " pieces are added to " ws1.Range("E4") & Chr(13_
        
    Chr(13) & "Model   " ws1.Range("E6") & Chr(13) & Chr(13) & "On date " ws1.Range("E2") & Chr(13) & Chr(13) & "Total is now  " ws2.Range(r)
    End If
    End Sub 
    Attached Files Attached Files

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Error in routing the values from one sheet to another

    Your missing the quotes around the 2nd sheet name it should be
    Please Login or Register  to view this content.
    Edit* After looking at you workbook I noticed there isn't an Item3 sheet so the sheet name is likely incorrect??
    Last edited by gmr4evr1; 12-13-2015 at 10:54 AM. Reason: Added Edit*
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Forum Contributor
    Join Date
    08-02-2015
    Location
    Hyderabad
    MS-Off Ver
    2007
    Posts
    160
    Quote Originally Posted by gmr4evr1 View Post
    Your missing the quotes around the 2nd sheet name it should be
    Please Login or Register  to view this content.
    Edit* After looking at you workbook I noticed there isn't an Item3 sheet so the sheet name is likely incorrect??
    Ok will check and get back to you

  4. #4
    Forum Contributor
    Join Date
    08-02-2015
    Location
    Hyderabad
    MS-Off Ver
    2007
    Posts
    160

    Re: Error in routing the values from one sheet to another

    When I'm doing as per your instructions, getting error Subscript out of range

    If I remove double quotations I'm getting error Type Mismatch

    I don't know where I've gone wrong

  5. #5
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Error in routing the values from one sheet to another

    When I looked at your workbook the other day, there was no sheet named Item3.........Adding the quotes will do no good if there is no sheet named Item3, hence the ".....out of range error"

    Removing the quotes gives you a "......mismatch" error because to call a sheet, it needs the quotes.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Error transferring values to sheet when list box value not selected.
    By GavJ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-18-2013, 08:03 PM
  2. Routing cancellation
    By boomshank in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-08-2011, 08:23 AM
  3. Flow Routing in Reservoirs!
    By MarkFranklin in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-14-2007, 11:06 AM
  4. Error Handling whilst using routing slip
    By davittp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-28-2007, 08:41 AM
  5. routing slip
    By Noemi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-15-2006, 08:20 PM
  6. [SOLVED] Routing / email
    By Adrian in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-12-2005, 05:05 PM
  7. [SOLVED] routing slip
    By Jo in forum Excel General
    Replies: 0
    Last Post: 06-28-2005, 03:05 AM

Tags for this Thread

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