使用VBA将单元格格式从Sheet1复制到Sheet2 [英] Copy cell formats from Sheet1 to Sheet2 using VBA

查看:1275
本文介绍了使用VBA将单元格格式从Sheet1复制到Sheet2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码用于复制sheet1中的单元格,并仅将格式化粘贴到sheet2中的同一单元格上


表格("Sheet1")。范围(" ; A1")。复制表("Sheet2")。范围("A1")_ PasteSpecial.xlPasteFormats


当我运行此代码时,我收到以下错误消息"运行时错误424需要对象"


我还尝试使用cell()属性方法作为Range()属性方法的替代来运行代码。


任何和所有关于如何解决这个问题的建议都将不胜感激

解决方案

我确信一个合适的Excel人员将是在某个时候,但同时,尝试


表格("Sheet1")。范围("A1")。复制


Sheets(" Sheet2")。范围(" A1")。PasteSpecial(xlPasteFormats)


 


The following code is intended to copy a cell in sheet1 and paste the formating only onto the same cell in sheet2

Sheets("Sheet1").Range("A1").Copy Sheets("Sheet2").Range("A1")_PasteSpecial.xlPasteFormats

when i run this code i receive the following error message "Run time error 424 Object required"

I have also attempted to run the code using the cell() property method as a substitute for the Range() property method.

Any and all advice on how to solve this problem would be appreciated

解决方案

I'm sure a proper Excel person will be along sometime, but meanwhile, try

Sheets("Sheet1").Range("A1").Copy

Sheets("Sheet2").Range("A1").PasteSpecial(xlPasteFormats)

 


这篇关于使用VBA将单元格格式从Sheet1复制到Sheet2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆