append rows with new data

Roland53

New Member
Joined
Feb 18, 2005
Messages
11
I'm not sure where to begin on this one...Office Pro 03'


I am taking a list of data and blending it with an Excel database. For each row in the list of new data I need to take that information and add it in the proper row and in the proper columns in the database. The each row in the database is keyed off of a "Tag #"
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
sorry,

But this is a great mystery.
There is no correlation between the "audit info in the last columns" and the daily input. After some difficult copy and pasting and doing a search on the worksheet for all your audit info no match was found.

I tried to explain that you need simple examples to start with.
Like the example in my previous post...

kind regards,
ERik
 
Upvote 0
Thanks...here is another
Book1
ABCDE
1Sheet 1Before
2
3Tag #LegFtAuditorAudit date
415
525
635
745
8
9
10Sheet 2New Data
11
12Tag #AuditorAudit Date
131JJ1/5/2005
142JJ1/5/2005
158JJ1/5/2005
16
17Sheet 1After
18
19Tag #LegFtAuditorAudit date
2015JJ1/5/2005
2125JJ1/5/2005
2235
2345
24
25Sheet 3Exceptions
26
27Tag #Auditor
288JJ
Sheet1
 
Upvote 0
with sheets setup as this
run the code below please

are we coming closer?
kind regards,
Erik
Map2
ABCD
1Sheet 1Before
2
3Tag #LegFtAuditorAudit date
415
525
635
745
Database
Map2
ABCD
1Sheet 2New Data
2
3Tag #AuditorAudit Date
41JJ1-5-05
52JJ1-5-05
68JJ1-5-05
New data
Map2
ABCD
1Tag #Auditor
Exceptions


'you'll have to find the Tag# of sheet 2 in sheet 1
'this will be done one by one with a For Each loop

Code:
Option Explicit

Sub copy_data()
Dim cell      As Range
Dim tags      As Range
Dim newtags   As Range
Dim sourcerow As Long
Dim targetrow As Long
Dim c As Range

Set tags = Range(Sheets(1).Cells(4, 1), Sheets(1).Cells(65536, 1).End(xlUp))
Set newtags = Range(Sheets(2).Cells(4, 1), Sheets(2).Cells(65536, 1).End(xlUp))


For Each cell In newtags
sourcerow = cell.Row
      Set c = tags.Find(cell, LookIn:=xlValues)
      If Not c Is Nothing Then
      targetrow = c.Row
      Sheets(2).Range(Cells(sourcerow, 2), Cells(sourcerow, 3)).Copy _
      Sheets(1).Cells(targetrow, 3)
      Else
      Sheets(2).Range(Cells(sourcerow, 1), Cells(sourcerow, 2)).Copy _
      Sheets(3).Cells(65536, 1).End(xlUp).Offset(1, 0)
      End If
Next cell
End Sub
 
Upvote 0

Forum statistics

Threads
1,221,668
Messages
6,161,163
Members
451,687
Latest member
KENNETH ROGERS

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