Export data from excel spreadsheet to an excel database

yoko

Active Member
Joined
Sep 5, 2006
Messages
349
Hi,

I've got a spreadsheet with several sheets of data, in some of the sheets I would like to copy some of the data across to an excel database.

I know how to record the macro to copy the data needed e.g. stuff in cell's A1 B5 and D3 and get it pasted into the database under cells A1 B1 C1 but what I can’t do is get the macro to write the data to the next line every time the export button is pressed. All it does is over write what’s already there.

The idea is that the user of the spreadsheet enters data then it gets copied to a database for historical purposes

So for example after a week of pressing the export button everyday the database should have 5 lines of data (one for each day)

Hope that makes sense!

Thanks

Example of my code so far....

Code:
    Workbooks.Open Filename:="R:\OperEff\Dave\database.xls"
    Windows("Sharedealing CapPlanner V2.xls").Activate
    Range("I10").Select
    Selection.Copy
    Windows("database.xls").Activate
    Range("C2").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Windows("Sharedealing CapPlanner V2.xls").Activate
    Range("I11").Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("database.xls").Activate
    Range("B2").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False

' The code goes on to copy more items but its alot of code!'
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
58,249
Office Version
  1. 365
Platform
  1. Windows
Let's say that you want to paste the data into the first available cell in column C. Then instead of using:
Range("C2").Select

use this:
Range("C65536").End(xlUp).Offset(1,0).Select
 

Forum statistics

Threads
1,136,269
Messages
5,674,741
Members
419,525
Latest member
helensesc

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
Top