+ Reply to Thread
Results 1 to 5 of 5

While writing files from another workbook, keep empty cells empty!

  1. #1
    Registered User
    Join Date
    10-11-2012
    Location
    switzerland
    MS-Off Ver
    Excel 2010
    Posts
    38

    While writing files from another workbook, keep empty cells empty!

    Hello everyone

    First off the code:
    Please Login or Register  to view this content.
    With this code, I write all Data from Sheet1 in A.xlsx into Sheet1 in Main.xlsx.
    It is working perfectly with one exception.

    If, e.g. in A.xlsx there are empty cells, the cells in Main.xlsx show zeros (=0).

    How could I make it that empty cells in A show as empty cells in Main?

    Help is much appreciated
    Cheers

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: While writing files from another workbook, keep empty cells empty!

    Do you want to have formulas linked to A.xlsx?

    Or would the values be OK?
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    10-11-2012
    Location
    switzerland
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: While writing files from another workbook, keep empty cells empty!

    All I want is to get the values (but to keep the conditional formatting in Main.xlsx)

    If your above code is like a manual copy and paste (which overwrites cond. form.) I cannot use it.

    Cheers

    btw. you above line (wbA.Worksheets("Sheet1").Range("A1:ET2000").Copy
    ) throws an exception:

    Run Time Error 91, Object Variable or With Block Variable not set
    Last edited by nivoe; 11-09-2012 at 12:11 PM.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: While writing files from another workbook, keep empty cells empty!

    Why can't you use what I posted?

    All it does is copy and paste values, it doesn't overwrite any formatting.

    there were a couple of typos.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-11-2012
    Location
    switzerland
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: While writing files from another workbook, keep empty cells empty!

    Norie

    You are a life saver. It works. Thank you very much!

    Have a nice day

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1