linking folders to excel

G

Guest

is it possible to cut and paste a cell from one worksheet to another
worksheet in excel and have a corresponding workbook move folders.
i.e. I cut a paste a description of workbook A from one worksheet(named
"open") to another worksheet(named "closed"). As of right now workbook A is
saved in a folder named "open". I want the saved workbook to automatically
move to a folder named "closed". Is this possible?
 
D

Dave Peterson

If you want to copy from one worksheet to another:

dim fromRng as range
dim toRng as range

set fromrng = workbooks("open.xls").worksheets("open").range("b1")
set torng = workbooks("closed.xls").worksheets("closed").range("c99")

fromrng.copy _
destination:=torng

==============

These two worksheets could be in different workbooks or even in the same
workbook.

And if you want to move a file from one location to another, I think I'd use
SaveAs to save it to the new location, then Kill to delete the old file.

Dim myOldFileName As String
Dim myNewFileName As String

myOldFileName = Workbooks("open.xls").FullName
myNewFileName = "C:\closed\whatevertheclosedfilenameis.xls"

ActiveWorkbook.SaveAs Filename:=myNewFileName, FileFormat:=xlWorkbookNormal

Kill myOldFileName

===
But I'm not sure about the real details. Should I have used activeworkbook,
thisworkbook or something else???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top