• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA to bring data from another sheet where unique ID matches

JCTalk

Member
Hiya,

I am building a spreadsheet to monitor results from software deployments. Each day the results of the deployment will get dropped into Sheet2 (previous extract is cleared). The user will click a button on Sheet1 which should link to a macro which...

1. Asks the user which day number (numeric value) they are processing.
2. Bring back all values from ExtractColumn2 (B:B) on Sheet2 where the UniqueID in Sheet2!A:A matches the UniqueID in Sheet1!A:A.
3. Place each of the values from Sheet2's ExtractColumn2 in the Sheet1 column relevant to the day number the user entered initially (e.g. if user enters 1, then all the values go in Column W).

I've put in up to Day 18, but potentially I'd like it be able to cater for any future increases.

Document template attached.

I'd sincerely appreciate some ninja help here with some efficient VBA if you don't mind?

Many thanks in advance for your help guys and gals.
 

Attachments

  • VBA Required.xlsx
    10.8 KB · Views: 4
Hi !

A £12 code (a codeline, a pound !) :​
Code:
Sub Macro1()
    W = InputBox(vbLf & vbLf & " Which day ?", "  Deployment")
    If Not IsNumeric(W) Then Beep: Exit Sub
    VA1 = Sheet1.Cells(1).CurrentRegion.Columns(1).Value
    VA2 = Sheet2.UsedRange.Columns("A:B").Value
    Application.ScreenUpdating = False
For R& = 2 To UBound(VA2)
     V = Application.Match(VA2(R, 1), VA1, 0)
     If IsNumeric(V) Then Sheet1.Cells(V, 22 + W).Value = VA2(R, 2)
Next
    Application.ScreenUpdating = True
End Sub
Do you like it ? So thanks to click on bottom right Like !
 
Back
Top