复制行内容和格式(到另一张) [英] Copy a rows contents and formatting (to another sheet)

查看:101
本文介绍了复制行内容和格式(到另一张)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要的是将整行的内容和格式复制到另一张表。

What do I want is to copy an entire row's contents and formatting to another sheet.

目前,我不得不解决设置旧单元格内容到新的单元格内容,这样做只能复制内容而不是格式化。 (我的单元格有不同的颜色需要进行)

At the moment I've had to settle for setting the old cells contents to the new cells contents and in doing so it only copies the contents and not the formatting. (my cells have different colours that need to be carried across)

目前我有以下几点:(这对于单个单元格中的单元格可以正常工作)

At the moment I have the following: (this works fine for cells in the same sheet)

Range(Cells(45, 2), Cells(45, 3)).Copy Range(Cells(50, 2), Cells(50, 3))

但是,我试图从一张纸到另一张。 (从表'Front_Page'复制到'vg')。我尝试使用以下内容,显然它不起作用,但有人可以告诉我我做错了什么?

However, I'm trying to do it from one sheet to another. (Copy from sheet 'Front_Page' to 'vg'). I tried using the following, obviously it doesn't work, but can someone please tell me what am I doing wrong?

Range.Worksheet("Front_Page").Range(Cells(45, 2), Cells(45, 3)).Copy Worksheet("vg").Range(Cells(50, 2), Cells(50, 3))


推荐答案

看起来您尝试将单元格从FrontPages复制到vg,因为您在范围内使用单元格

Looks like you try to copy cells from "Front_Pages" to "vg" since you use "cells" inside "range"

范围(单元格...)。

Range (cells ...).

如果是这样,您可以简单地将单元格格式更改为excel一般范围;尝试以下代码:

If so, you can simply change the cell format as excel general range; try this code :

Sheets("vg").Range("B5") = Sheets("Front_Pages").Range("B4")
Sheets("vg").Range("C5") = Sheets("Front_Pages").Range("C4")

这篇关于复制行内容和格式(到另一张)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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