Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copy empty cells from one workbook to another - Code

Hello,

Sorry for posting 2 times. Date & time in my computer were not correctly
set.

In addition to what I've written before, here is the code I wrote:

Sub Dataacquire()
Workbooks.Open "data.xls"
Worksheets("sheet1").Range("b1:d19").Copy _
ThisWorkbook.Worksheets("sheet1").Range("b1:d19")
ActiveWorkbook.Close SaveChanges:=False
End Sub

My problem that empty cells are not copied as empty and
because of this I get an error messages in other worksheets (like #VALUE).

How Can I solve this problem ?

Thank you
David Cohen





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Copy empty cells from one workbook to another - Code

3 suggestions
1) copy Values so that any formulas or other file specifics are left behind
2) since you know the file name close it by name, avoids issues if you add
more code later
3) clear the clipboard after copy

Sub Dataacquire()
Workbooks.Open "data.xls"
Worksheets("sheet1").Range("b1:d19").Value.Copy _
ThisWorkbook.Worksheets("sheet1").Range("b1:d19")
Application.cutcopymode = False
Workbooks("data.xls").Close SaveChanges:=False
End Sub

"David Choen" wrote:

Hello,

Sorry for posting 2 times. Date & time in my computer were not correctly
set.

In addition to what I've written before, here is the code I wrote:

Sub Dataacquire()
Workbooks.Open "data.xls"
Worksheets("sheet1").Range("b1:d19").Copy _
ThisWorkbook.Worksheets("sheet1").Range("b1:d19")
ActiveWorkbook.Close SaveChanges:=False
End Sub

My problem that empty cells are not copied as empty and
because of this I get an error messages in other worksheets (like #VALUE).

How Can I solve this problem ?

Thank you
David Cohen






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
Copy empty cells from one workbook to another - Code Dave Peterson Excel Discussion (Misc queries) 1 September 23rd 05 02:10 PM
Copy empty cells from one worksheet to another David Cohen Excel Programming 1 September 22nd 05 10:50 PM
Copy empty cells from one workbook to another - Code David Choen Excel Programming 0 September 22nd 05 01:01 PM
Macro to copy value in empty cells Esrei Excel Discussion (Misc queries) 3 April 19th 05 03:54 PM
SOS VBA Code Emergency: need to copy tell to empty cell direct below where values in adjacent cells in different column are equal to each other. Steven Rosenberg Excel Programming 4 August 5th 03 05:05 AM


All times are GMT +1. The time now is 11:23 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"