Adding data to end of row based on A1 value

Royalty13

New Member
Joined
Nov 14, 2013
Messages
6
I'm working with a rather long list that I'm trying to add to the end of a spreadsheet. I know there are formula's out there that can go to the next empty cell in a row or a column, but I need a vba code that can go to the next empty cell in a row based on the first column's value.
For example:

Sample list:
DogPitbull
CatSphynx
DogBeagle
BirdParrot

<tbody>
</tbody>

Sample spreadsheet:
BirdToucanOwlEagle
DogRottweiler
CatSiamese

<tbody>
</tbody>


Final result:
BirdToucanOwlEagleParrot
DogRottweilerPitbullBeagle
CatSiameseSphynx

<tbody>
</tbody>

Is there any easy way to do this?
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
With "Sample data" in sheet "Data" and "Sample Spreadsheet" in sheet "Results
Actual data starting rows 2.
Try this for update on sheet "Results":-
Code:
[COLOR="Navy"]Sub[/COLOR] MG24Apr07
[COLOR="Navy"]Dim[/COLOR] RngR [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range, n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Dim[/COLOR] Lst [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] RngD [COLOR="Navy"]As[/COLOR] Range, Q [COLOR="Navy"]As[/COLOR] Variant
[COLOR="Navy"]With[/COLOR] Sheets("Results")
[COLOR="Navy"]Set[/COLOR] RngR = .Range("A2", .Range("A" & Rows.Count).End(xlUp))
[COLOR="Navy"]End[/COLOR] With
[COLOR="Navy"]With[/COLOR] CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] RngR
    Lst = Cells(Dn.Row, Columns.Count).End(xlToLeft).Column
    .Item(Dn.Value) = Array(Dn, Lst)
[COLOR="Navy"]Next[/COLOR]
[COLOR="Navy"]With[/COLOR] Sheets("Data")
    [COLOR="Navy"]Set[/COLOR] RngD = .Range("A2", .Range("A" & Rows.Count).End(xlUp))
[COLOR="Navy"]End[/COLOR] With
    [COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] RngD
        [COLOR="Navy"]If[/COLOR] .exists(Dn.Value) [COLOR="Navy"]Then[/COLOR]
            Q = .Item(Dn.Value)
            Q(0).Offset(, Q(1)) = Dn.Offset(, 1).Value
            Q(1) = Q(1) + 1
            .Item(Dn.Value) = Q
        [COLOR="Navy"]End[/COLOR] If
  [COLOR="Navy"]Next[/COLOR] Dn
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]With[/COLOR]
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,215,045
Messages
6,122,840
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top