LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copying cells from one sheet to another if document has been saved.


Hello again.

Now I have finally found out some way to loop through my files bu
there are still some major functions I can't understand how to solve.

Here's the loop:

Do While FNames < ""

'SourceRcount = SourceRange.Rows.Count

Set myBook = Workbooks.Open(FNames)

Set SourceRange = myBook.Worksheets(1).Range("A4:L20")

SourceRcount = SourceRange.Rows.Count

'Set destrange = basebook.Worksheets(1).Cells(counter, "O")
Set destrange = basebook.Worksheets(1).Range("A4")

'Skriv in arbetsbokens namn i kolumn H
basebook.Worksheets(1).Cells(counter, "M").Value = myBook.Name
If myBook.Worksheets(1).Range("L1") = Date Then

'SourceRange.Copy destrange
' Instead of this line you can use the code below to copy only th
values

With SourceRange
'Set destrange = basebook.Worksheets(1).Cells(counter, "O"). _
Resize(.Rows.Count, .Columns.Count)
Set destrange = basebook.Worksheets(1).Range("A4"). _
Resize(.Rows.Count, .Columns.Count) End With
destrange.Value = SourceRange.Value
End If

myBook.Close False

counter = counter + SourceRcount
FNames = Dir()

Loop

The lines written in red above are where I have difficulties.

On every new worksheet I want only the rows which has some value
copied onto the destination worksheet.
On the destination worksheet I want the first copied values to b
copied to Cell A4 and the next values on the cells A5, A6 and so on.
When the loop continues to the next file and copies the values I wan
it to continue to copy the values the next empty cell in th
destination worksheet.

Anyone who can help me?

/ander

--
a94andw
-----------------------------------------------------------------------
a94andwi's Profile: http://www.excelforum.com/member.php...fo&userid=2107
View this thread: http://www.excelforum.com/showthread.php?threadid=38446

 
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
How do I recover an Excel document saved not saved as Darryl Excel Discussion (Misc queries) 6 January 5th 10 03:39 AM
Copying cells from one sheet to another Andrew Excel Worksheet Functions 4 September 24th 09 05:19 AM
Document Not Saved HMH Excel Discussion (Misc queries) 2 May 9th 08 11:13 PM
Link Excel S/Sheet cells to Table in Word document Chris Gorham Excel Discussion (Misc queries) 2 January 20th 08 08:13 PM
copying cells to another document Jeffries'' Ex Excel Discussion (Misc queries) 1 August 1st 05 07:36 PM


All times are GMT +1. The time now is 02:51 AM.

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"