Ask Experts Questions for FREE Help !
Ask
    rsdjimbie's Avatar
    rsdjimbie Posts: 96, Reputation: 3
    Junior Member
     
    #1

    Oct 11, 2011, 11:41 PM
    What is it I am missing here when running Mod.2 ?
    Plesae refer to Mod. 2 in the macros, run the mod only to be shown a error message "Type mismatch". Thank you.

    Code:
    Sub MonthlyDispatchedUnits()
    
    Dim Col As Long
    Dim LINES As Range, Ln As Range, LnFND As Range
    Dim wsMH As Worksheet
    
        Set wsMH = Sheets("Manhood")
    
        With Sheets("Invoice")
            Set LINES = .Range("K17").SpecialCells(xlConstants)
            Col = wsMH.Cells.Find(Month(.[G1]), LookIn:=xlValues, LookAt:=xlWhole).Column
            
            For Each Ln In LINES
                Set LnFND = wsMH.Cells.Find(Ln, LookIn:=xlValues, LookAt:=xlWhole)
                Set LnFND = wsMH.Cells.Find("Dispatched", LnFND, LookIn:=xlValues, LookAt:=xlWhole)
                If LnFND Is Nothing Then GoTo ErrorExit
                wsMH.Cells(LnFND.Row, Col).Value = Ln.Offset(0, 1).Value
                Set LnFND = Nothing
            Next Ln
        End With
        
        Exit Sub
        
    ErrorExit:
        MsgBox "Could not find '" & Ln & "' on sheet HO Plan. Update sheet so there is a match."
    End Sub
    rsdjimbie's Avatar
    rsdjimbie Posts: 96, Reputation: 3
    Junior Member
     
    #2

    Oct 11, 2011, 11:49 PM
    Attached sample.
    Attached Files
  1. File Type: zip Sample Mod 2.zip (22.2 KB, 22 views)
  2. JBeaucaire's Avatar
    JBeaucaire Posts: 5,426, Reputation: 997
    Software Expert
     
    #3

    Oct 12, 2011, 01:05 AM
    A few issues here.

    1) The sample sheet is devoid of useful data... or any context/explanation to what is going on here.

    2) this doesn't make sense to me:
    Code:
    Set LINES = .Range("K17").SpecialCells(xlConstants)
    Why use SpecialCells on a single cell? Should there be a much larger range than just K17 for this evaluation? Especially since you are setting up a LOOP later to cycle through all the cells in the range LINES. This needs correction.

    3) this doesn't make sense to me:
    Code:
    Col = wsMH.Cells.Find(Month(.[G1]), LookIn:=xlValues, LookAt:=xlWhole).Column
    .G1 is empty, part of a merged cell. If you meant that to be on the invoice sheet, remove that leading period, which currently attaches it to the With Sheets("Invoice").

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Missing persons accra ghana Looking for Labrams Osman missing since Feb 12, 4:30pm [ 13 Answers ]

5ft.7in appox. 130lbs long dark brown hair caucasian, very attractive Labanon decent.

Mod? [ 5 Answers ]

I have a xbox 360 mod and the right stick is giving me problems. I will push the stick up and on the screen nothing happens so I push it down and still nothing happens... Y?

Kenmore mod 100.63952101 stops running [ 1 Answers ]

I have kenmore model 110.63952101 it runs for a while then shuts down like an over heat poblem, but it runs longer if I am drying jeans could it be motor or heating elment problem?

HALO 2.anyone know how to mod [ 1 Answers ]

How do you modify games like halo 2 so you can play them online?:cool:


View more questions Search