Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
seags
 
Posts: n/a
Default auto saving transfered data


I have 2 workbooks, one called "invoice" the other called "invoice log"


I can transfer the data from the "invoice" workbook to the "invoice log
workbook OK.

My problem is how do I save the transfered data in the "invoice log"
workbook and then do an auto shift down a row for when the next lot of
data is transfered from the "invoice " workbook.


--
seags
------------------------------------------------------------------------
seags's Profile: http://www.excelforum.com/member.php...o&userid=30993
View this thread: http://www.excelforum.com/showthread...hreadid=508358

  #2   Report Post  
Posted to microsoft.public.excel.misc
Ken Johnson
 
Posts: n/a
Default auto saving transfered data

Hi seags,
the only way I know is to paste the following code into the
ThisWorkbook code module of the invoice log workbook...

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Worksheets(1).Rows(1).Insert
End Sub

It's an event procedure that is triggered when you save the workbook.
All it does is insert a row at the top of the first sheet in the
workbook. When you reach the bottom of the worksheet it will result in
a run-time error. You will then have to start using the next worksheet
after changing the code to Worksheets(2).Rows(1).Insert

If you're not sure how to get the code into the right place then follow
these steps..

Copy the code. Press Alt + F11 to get into the Visual Basic Editor. Go
ViewProject Explorer to ensure that the Project Explorer is visible.
Double the ThisWorkbook icon in the Project Explorer (has the green
Excel X). Paste the code into place in the white space just to the
right of the Project Explorer.

Ken Johnson

  #3   Report Post  
Posted to microsoft.public.excel.misc
Ken Johnson
 
Posts: n/a
Default auto saving transfered data

Hi seags,
If you decide you are going to try to do it this way, then you should
notice that after pasting the code the first two lines will appear red.
This is caused by the structure of the text in the forum. The forum has
added a line break to the opening line of the code. You can either edit
the opening line so that the end of it reads "Cancel As Boolean)"
(without the speech marks) or paste the following code in place which
has a VBA style linebreak to solve the problem...

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
Worksheets(1).Rows(1).Insert
End Sub

Ken Johnson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Macro to Copy & Paste [email protected] Excel Worksheet Functions 0 December 1st 05 01:56 PM
From several workbooks onto one excel worksheet steve Excel Discussion (Misc queries) 6 December 1st 05 08:03 AM
How Do I Automatically Refresh Auto Filtered Data? Greta Excel Discussion (Misc queries) 1 September 1st 05 05:04 PM
Pulling data from 1 sheet to another Dave1155 Excel Worksheet Functions 1 January 12th 05 05:55 PM
How do I avoid saving multiple data files for versioning purposes. [email protected] Excel Discussion (Misc queries) 1 December 13th 04 12:57 PM


All times are GMT +1. The time now is 09:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"