Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
964 views
in Technique[技术] by (71.8m points)

excel - Error while copying more than 8202 characters from one cell to another

Problem - I have around more than 8202 characters in once cell say Range("A1").

Now I would like to copy the content of cell(A1) to cell(A2) using VBA. I'm using below Code

Sheets("XYZ").Range("A2") = Sheets("XYZ").Range("A1")

After the execution of the Code. It gives "Application Defined Or Object Defined Error !!"

Please help/assist with your expert comments.

Observation - If I reduce the length of "A1" cell to 8202 or less then about code works!

I'm Confused. Pls assist.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Change your code to

Sheets("XYZ").Range("A2") = Sheets("XYZ").Range("A1").Value

and it will work.

Not really sure why though, as .Value is the default property of a range.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...