ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pasting the same Value into a Range of Cells (https://www.excelbanter.com/excel-programming/286801-pasting-same-value-into-range-cells.html)

mmc308[_2_]

Pasting the same Value into a Range of Cells
 
Can anyone advise how I can acheive this?

I want to be able to select a number of cells, paste the value of 1 into the
cells and change font to bold, with background of yellow

I have been able to do this with the following macro however it will only
paste the value "1" into the first cell, the formatting is applied to all
the selected range, however I want it to paste 1 into all the cells I have
selected

ie I select 1R x 3C run the macro below it will place the value of 1 into
the first cell and then applies the formatting to the 3 cells, I want the
value in there as well?

Hope this is clear
TIA
Michael

' Full_day_Hol Macro

ActiveCell.FormulaR1C1 = "1"
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End Sub



Ron de Bruin

Pasting the same Value into a Range of Cells
 
Selection.value = 1
You can use

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"mmc308" wrote in message ...
Can anyone advise how I can acheive this?

I want to be able to select a number of cells, paste the value of 1 into the
cells and change font to bold, with background of yellow

I have been able to do this with the following macro however it will only
paste the value "1" into the first cell, the formatting is applied to all
the selected range, however I want it to paste 1 into all the cells I have
selected

ie I select 1R x 3C run the macro below it will place the value of 1 into
the first cell and then applies the formatting to the 3 cells, I want the
value in there as well?

Hope this is clear
TIA
Michael

' Full_day_Hol Macro

ActiveCell.FormulaR1C1 = "1"
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End Sub





Tom Ogilvy

Pasting the same Value into a Range of Cells
 
' Full_day_Hol Macro

With Selection
.Value = 1
With .Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With .Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End with
End Sub

--
Regards,
Tom Ogilvy


mmc308 wrote in message
...
Can anyone advise how I can acheive this?

I want to be able to select a number of cells, paste the value of 1 into

the
cells and change font to bold, with background of yellow

I have been able to do this with the following macro however it will only
paste the value "1" into the first cell, the formatting is applied to all
the selected range, however I want it to paste 1 into all the cells I have
selected

ie I select 1R x 3C run the macro below it will place the value of 1 into
the first cell and then applies the formatting to the 3 cells, I want the
value in there as well?

Hope this is clear
TIA
Michael

' Full_day_Hol Macro

ActiveCell.FormulaR1C1 = "1"
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End Sub





Don Guillett[_4_]

Pasting the same Value into a Range of Cells
 
Sub putnum()
With Selection
..Value = 1
..Font.FontStyle = "bold"
..Interior.ColorIndex = 6
End With
End Sub

--
Don Guillett
SalesAid Software

"mmc308" wrote in message
...
Can anyone advise how I can acheive this?

I want to be able to select a number of cells, paste the value of 1 into

the
cells and change font to bold, with background of yellow

I have been able to do this with the following macro however it will only
paste the value "1" into the first cell, the formatting is applied to all
the selected range, however I want it to paste 1 into all the cells I have
selected

ie I select 1R x 3C run the macro below it will place the value of 1 into
the first cell and then applies the formatting to the 3 cells, I want the
value in there as well?

Hope this is clear
TIA
Michael

' Full_day_Hol Macro

ActiveCell.FormulaR1C1 = "1"
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End Sub





mmc308[_2_]

Pasting the same Value into a Range of Cells
 
Many Thanks! it's working

Michael

"mmc308" wrote in message
...
Can anyone advise how I can acheive this?

I want to be able to select a number of cells, paste the value of 1 into

the
cells and change font to bold, with background of yellow

I have been able to do this with the following macro however it will only
paste the value "1" into the first cell, the formatting is applied to all
the selected range, however I want it to paste 1 into all the cells I have
selected

ie I select 1R x 3C run the macro below it will place the value of 1 into
the first cell and then applies the formatting to the 3 cells, I want the
value in there as well?

Hope this is clear
TIA
Michael

' Full_day_Hol Macro

ActiveCell.FormulaR1C1 = "1"
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End Sub






All times are GMT +1. The time now is 01:35 PM.

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