Adding Data from one excel worksheet to another

Gman1950

New Member
Joined
Aug 27, 2002
Messages
15
I have two Excel files, the first is from an export of found records in a dbf. The second is a Excel file with a macro that will open and copy & paste the data from the first file into the second file. The number of rows of data (records) exported varies each time the data is exported from the dbf. What I need to do is that every time I open and run the 2nd Excel files macro, the new data will be appended at the end of the first after inserting a couple of blank rows. So that the data keeps building in the 2nd Excel file.

Any help will be greatly appreciated.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I dont really understand this problem. I probably need more info.

Is it not possible to import the data straight from the Db file to the second spreadsheet?
 
Upvote 0
What I am trying to do is build a master excel sheet with a list of parts during the week that will be shipped on Friday. Identifing the parts during the week and then putting them in the master excel sheet is much easier than waiting till the last minute. I just found that I could export the dbf as a excel sheet and I wrote a simple macro that would copy & paste from that file into the "master" file. I would like to be able to copy & paste into the "master" everytime I found records parts that needed to be shipped on Friday.

I hope this clears it up. If you have a better way to import into the excel "master" from a dbf file I would appreciate it.
 
Upvote 0
Hello Gman1950,

This will start you off in the right direction:

It finds the end of data on Sheet1 (Col A)

It copies the data from Sheet1

It finds the next available row on Sheet 2 (Col B)

It pastes the data from Sheet1 to Sheet2



<pre>

Sub MergeWS()
'
Dim LastRow As Long
Dim NextRow As Long

' determine where the data ends on Column B Sheet1
Worksheets("Sheet1").Activate
Range("B65536").Select
ActiveCell.End(xlUp).Select
LastRow = ActiveCell.Row

' copy the data from Column B in Sheet 1
Range("B1:B" & LastRow).Copy

' Determine where to add the new data in Column C Sheet 2
Worksheets("Sheet2").Activate
Range("C65536").Select
ActiveCell.End(xlUp).Offset(1, 0).Select
NextRow = ActiveCell.Row

' paste the data to Column C Sheet 2
Worksheets("Sheet2").Range("C" & NextRow).Select
ActiveSheet.Paste
Application.CutCopyMode = False

' point to cell A1 .... just because
Range("A1").Select

End Sub

</pre>

Hope this helps!
 
Upvote 0
I think you can anme your ranges, so when you are using your macro to copy and past the function your named range is copied. I think this is what you want. I'm not too good at VB so I cannot give you a high tech way of doing it.

I Hope this helps!!??

^_^
 
Upvote 0

Forum statistics

Threads
1,222,013
Messages
6,163,390
Members
451,834
Latest member
tomtownson

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