Formula help

kole

New Member
Joined
Sep 25, 2005
Messages
5
I have a workbook that updates daily. When it updates the updated value goes in the top row of the column lets say A3 and moves the rest of the numbers in the column down one row. I want to link these values to another workbook. What formula can I use to copy these values. example The first day it copies A3:A212 the next day A3:A213. Can anyone help?
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
You can copy A3 (in the active workbook) to the last populated cell in Column A with something like:

Code:
Range("A3:A" & Rows.Count).End(xlUp).Copy Workbooks("myWorkbookName.xls").Worksheets("mySheet").Range("A" & Rows.Count).End(xlUp).Offset(1)

Or everything in Column A that's a number with:
Code:
Range("A:A").SpecialCells(xlCellTypeConstants, xlNumbers).Copy Workbooks("myWorkbookName.xls").Worksheets("mySheet").Range("A" & Rows.Count).End(xlUp).Offset(1)

How's that? Post back if you have any problems.

I forgot to mention that either of these would go in a standard code module.

  • How to use the above code:

    Press Alt-F11 to open the VBE.
    Press Control-R to open the Project Explorer.
    Click "Microsoft Excel Objects" for the file you're working on.
    Select Insert, Module from the drop down menus.

    Open the Code pane with F7.
    Paste the above code in.
    Press Alt-Q to close the VBE and return to Excel
 
Upvote 0
When I use either of the codes I get and error message,"Invalid outside procedure" and it highlights (1) at the end of the code.
 
Upvote 0
The code I posted should go between a "Sub" declaration and "End Sub".

Insert a module using Insert, Module (from the VBE menus), and write this code in the module that appears. You can run this from withing the VBE (F5 or Run, Run Sub/Userform, or from Excel using Tools, Macro, Macros (Alt-F8).

Code:
Sub myCopyTest()
    Range("A3:A" & Rows.Count).End(xlUp).Copy Workbooks("myWorkbookName.xls").Worksheets("mySheet").Range("A" & Rows.Count).End(xlUp).Offset(1)
End Sub

That's all it'll do is just copy cells (from the active sheet. HTH
 
Upvote 0

Forum statistics

Threads
1,207,392
Messages
6,078,221
Members
446,323
Latest member
fishezuk

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