我在Excel中有一个宏,可以准确地将所有数据从一个页面复制到另一个页面。
Dim c As Range
For Each c In Sheets("Data").Range("A1:L" & bottomL)
If (c.Value = "Title1" Or c.Value = "Title2" Or c.Value = "Title3" Or c.Value = "Title4") Then
Intersect(c.Parent.Columns("A:Q"), c.EntireRow).Copy Worksheets("Portfolio").Range("A" & x + 1)
x = x + 1
End If
Next c
现在,我需要添加一行来指定从给定列复制的字符数(即只复制C列中的前9个字符),类似于下面的代码:
For Each cell In ws.Range("C:C").Cells
cell.Offset(0, 1).Value = Left(cell.Value, 9)
Next cell
我能够将其无缝插入原始代码的最简单方法是什么?
谢谢!
答案 0 :(得分:0)
第一次循环后:
{
"comment1": "Metadata.json - Insert the e-book's metadata here. WIP",
"comment2": "Technical metadata - This is the where the cover image is specified. Recommended to use ePub V2.0.1 over 3.0 for epubVersion and Reflowable rather than Fixed for textPresentation (unless doing a project that requires a specific layout). mobiCover and generateKindle are currently unused but added for futureproofing.",
"epubCover": "cover.jpg",
"mobiCover": "cover.jpg",
"fileName": "IdealogicalEcho",
"epubVersion": "2.0.1",
"textPresentation": "Reflowable",
"generateKindle": "no",
"comment3": "Book metadata - Information about the e-book itself. Language is specified with ISO 639-1. Rights can be worldwide, country specific or under a permissable license such as Creative-Commons SA",
"title": "Google's Idealogical Echochamber: How bias clouds our thinking about diversity and inclusion",
"creator": "James Damore",
"subject": "Academic",
"publisher": "Hal Motley",
"ISBN": "-",
"language": "en",
"rights": "Creative Commons BY-SA 4.0",
"comment4": "This is the page order that the e-book has. The first number before the colon is the page order, the second is the indentation, third is the page name and fourth is file itself.",
"pages": [
{
"pageNumber": "0",
"indentation": "0",
"pageName": "Cover",
"fileName": "bookcover.xhtml"
},
{
"pageNumber": "1",
"indentation": "0",
"pageName": "Title",
"fileName": "title.xhtml"
},
{
"pageNumber": "2",
"indentation": "0",
"pageName": "Indicia",
"fileName": "indicia.xhtml"
},
{
"pageNumber": "3",
"indentation": "0",
"pageName": "License",
"fileName": "license.xhtml"
},
{
"pageNumber": "4",
"indentation": "0",
"pageName": "Contents",
"fileName": "toc.xhtml"
},
{
"pageNumber": "5",
"indentation": "0",
"pageName": "Foreword",
"fileName": "foreword.xhtml"
},
{
"pageNumber": "6",
"indentation": "0",
"pageName": "Article",
"fileName": "article.xhtml"
}
]
}