Append columns to existing worksheet?

C

Chris Burnette

I need to create a VBA function that will append a set of 10 columns from one
worksheet to a row of another worksheet when a certain column in both
worksheets has the same value. I am familiar with VBA, but I'm a newb to
Excel, so I'm not quite sure how to do this.

Specifically, I need to use the title of a book as the matching criteria.
This is somewhat complicated by the fact that one worksheet just has a Title
column whereas the other has columns for both Title and Subtitle. In any
case, when the two columns match I need to append a set of 10 columns (I
figure I can probably just use a range for this) to the row in which the
match was found.

I don't know the proper syntax, but it should look something like this:

For Each Row in Worksheet
If Worksheet1.Title = Worksheet2.Title OR
(Worksheet1.Title & ": " & Worksheet1.Subtitle) = Worksheet2.Title
THEN
APPEND Worksheet2.Range(A-J)
Next Row

So, the idea is to cycle through all the rows in the worksheet, check
whether or not the titles are the same, and if so, append the named range to
the end of the row in Worksheet1.

Does anyone know how to do this? Any help would be appreciated.

Thanks,

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top