简体   繁体   中英

Copy over sheet1

In Excel 2007: I want to copy over values in SHEET2 so that it is identical to Sheet1 I am doing it with:

=(SHEET1!B1)

This has the side effect of copying a 0 instead of an empty cell. (or a date 01-01-1900)

How can I copy over the SHEET1 Values while ignoring empty cells?

An example of what I want to see:

SHEET1
A1|B1|
  | 3|

SHEET2
A1|B1|
  | 3|

Not
A1|B1|
 0| 3|

I have two solutions for you.

Formula:

=IF(Sheet1!A1 = ""; ""; Sheet1!A1)


Macro:

Sub test()
    Sheets("Sheet1").Select
    Cells.Select
    Selection.Copy
    Sheets("Sheet2").Select
    Cells.Select
    Sheets("Sheet2").Paste
End sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM