ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Fill Range With A Value (https://www.excelbanter.com/excel-worksheet-functions/170626-fill-range-value.html)

Derek Hart

Fill Range With A Value
 
What code would I use to fill a all the cells in a selected range with the
same value. The user will highlight a range, and I want to simulate as if an
item were pasted in, except it will be in code. How do I fill every cell
with this one item:

myKey = "Test"
Selection.Range.Value = myKey



JMB

Fill Range With A Value
 
try:
Selection.Value = myKey


"Derek Hart" wrote:

What code would I use to fill a all the cells in a selected range with the
same value. The user will highlight a range, and I want to simulate as if an
item were pasted in, except it will be in code. How do I fill every cell
with this one item:

myKey = "Test"
Selection.Range.Value = myKey





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

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