ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Paste a constant (https://www.excelbanter.com/excel-programming/390834-paste-constant.html)

Rick

Paste a constant
 
I'm using the following code to past activeCell data to a different sheet in
a different book. My problem is how do I past a constant in the next cell to
the right?

ThsWrkBk.Activate
Sheets(MstrSht).Activate
ActiveCell.Offset(0, 5).Activate
ActiveCell.Select
Selection.Copy
Workbooks(BkNme).Activate
Sheets(ShtNme).Select
ActiveCell.Offset(0, 1).Activate
ActiveCell.Select
Selection.PasteSpecial Paste:=XlPasteVariable(PstTyp), Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
ActiveCell.Offset(0, 1).Activate
ActiveCell.Select
What goes here if I want to paste a constant of "N"?

Rick Rothstein \(MVP - VB\)

Paste a constant
 
I'm using the following code to past activeCell data to a different sheet
in
a different book. My problem is how do I past a constant in the next cell
to
the right?

ThsWrkBk.Activate
Sheets(MstrSht).Activate
ActiveCell.Offset(0, 5).Activate
ActiveCell.Select
Selection.Copy
Workbooks(BkNme).Activate
Sheets(ShtNme).Select
ActiveCell.Offset(0, 1).Activate
ActiveCell.Select
Selection.PasteSpecial Paste:=XlPasteVariable(PstTyp),
Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
ActiveCell.Offset(0, 1).Activate
ActiveCell.Select
What goes here if I want to paste a constant of "N"?


Since "N" wasn't copied into the paste buffer, you can't Paste it into a
cell. However, why wouldn't this be just a straight assignment...

ActiveCell.Value = "N"

Rick



All times are GMT +1. The time now is 10:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com