Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 05-10-2015, 03:58 PM
NoSparks NoSparks is offline Lookup / Paste Multi Values VBA Windows 7 64bit Lookup / Paste Multi Values VBA Office 2010 32bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

To find locations of the Transfer Number you might want to use range.find and .findnext
See https://msdn.microsoft.com/en-us/lib.../ff839746.aspx

Here's how it could be used in your Transfer sub
Code:
Sub Transfer()
    
TransferNumber = InputBox(Prompt:="Transfer Number?", Title:="Number?")
With Sheets("Transfer Log").Range("A:A")
    Set fndNum = .Find(TransferNumber, LookIn:=xlValues)
    If Not fndNum Is Nothing Then   '<~~ the transfer number was found
        firstAddress = fndNum.Address
        Do
            With Sheets("Transfer Form")
                'find the row to write to
                writeRow = .Cells(Rows.Count, "A").End(xlUp).Row + 1
                .Cells(writeRow, 1).Resize(1, 4).Value = fndNum.Offset(0, 2).Resize(1, 4).Value
            End With
            Set fndNum = .FindNext(fndNum)
        Loop While Not fndNum Is Nothing And fndNum.Address <> firstAddress
    End If
End With

End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Lookup multiple values and compare different scenarios to get a specific result mws Excel 5 05-24-2014 04:52 AM
Way to insert/paste frequently used values? leemoreau Word 1 09-19-2013 03:35 AM
How can match or lookup values from two separate tables? klawk26 Excel 1 07-31-2012 09:04 PM
Multi-Variable Lookup help ebolton Excel 8 05-05-2011 05:28 AM
Word - Calculate and paste values from Excel sheet Augf87 Word 1 07-06-2009 10:26 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:59 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft