PC Review


Reply
Thread Tools Rate Thread

Adding data to a closed sheet

 
 
Dan
Guest
Posts: n/a
 
      6th Jun 2008
Will it be possible to copy data (6 consecutive cells) from my current sheet
to the end of another sheet that is not currently open.
Many thanks
Dan
 
Reply With Quote
 
 
 
 
Gary''s Student
Guest
Posts: n/a
 
      6th Jun 2008
1. open the closed workbook
2. perform the copy/paste
3. re-close the previously closed workbook
--
Gary''s Student - gsnu200790


"Dan" wrote:

> Will it be possible to copy data (6 consecutive cells) from my current sheet
> to the end of another sheet that is not currently open.
> Many thanks
> Dan

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      6th Jun 2008
Hi Dan, try
http://www.rondebruin.nl/copy1.htm

See the last example
"What if the Database sheet is in another workbook"




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Dan" <(E-Mail Removed)> wrote in message news:3C65B204-D2A7-4986-832F-(E-Mail Removed)...
> Will it be possible to copy data (6 consecutive cells) from my current sheet
> to the end of another sheet that is not currently open.
> Many thanks
> Dan

 
Reply With Quote
 
john
Guest
Posts: n/a
 
      6th Jun 2008
Hi Dan,
Gary's resopnse is correct but to give a little more meat to bones of what
he is saying an approach along the lines of following could be used. The
FileLocked function checks to see if the file is already open read / write
mode. This is not something I have written (sorry to author for not giving
credit) but I make extensive use of it in various applications. You should
get the general idea of how to apply what Gary was saying to.

Hope helpful

Sub AddToFile()
Dim DestWB As Workbook
Dim DBFile As String
Dim mytitle As String

mytitle = "Add Data To File"

DBFile = "C:\WhichDirectory\WhichFile.xls" '<< change as required

'Check if Read / Write File Already Open
If FileLocked(DBFile) Then
msg = MsgBox("Read / Write File Already Open.", 16, mytitle)

Else
Set DestWB = Workbooks.Open(DBFile, Password:="mypassword")

'do your stuff here

DestWB.Close True

End If
End Sub

Function FileLocked(strFileName As String) As Boolean

On Error Resume Next

' If the file is already opened by another process,
' and the specified type of access is not allowed,
' the Open operation fails and an error occurs.
Open strFileName For Binary Access Read Lock Read As #1
Close #1

' If an error occurs, the document is currently open.
If Err.Number <> 0 Then
FileLocked = True
Err.Clear
End If
On Error GoTo 0
End Function





--
jb


"Dan" wrote:

> Will it be possible to copy data (6 consecutive cells) from my current sheet
> to the end of another sheet that is not currently open.
> Many thanks
> Dan

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
adding new data to another sheet from the main sheet ycwkpp898 Microsoft Excel Misc 1 6th Jan 2009 04:16 PM
Send Data From Active Sheet to Closed Sheet on Network ryguy7272 Microsoft Excel Programming 4 3rd Jul 2008 08:44 PM
Consolidation of data from cell in active sheet of closed workbook =?Utf-8?B?TmVpbCBYIFBlZWw=?= Microsoft Excel Worksheet Functions 3 8th Mar 2007 02:35 PM
adding data from one sheet to another sheet as a dropdown list bo. =?Utf-8?B?Z2F0b3JndXk=?= Microsoft Excel Misc 1 18th Feb 2005 10:51 PM
importing data from closed sheet Quirrell Microsoft Excel Misc 0 19th Sep 2003 02:28 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:50 AM.