ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to: copy value from active sheet to all other sheets with VBA (in desired cell) (https://www.excelbanter.com/excel-programming/444014-how-copy-value-active-sheet-all-other-sheets-vba-desired-cell.html)

DVAL

How to: copy value from active sheet to all other sheets with VBA (in desired cell)
 
Does anybody can help me?
I tried with command button
with macro:

Sub Button1_Click()
'
' Button1_Click Macro
'
Dim ws As Worksheet

Range("C3").Select
Selection.Copy
For Each ws In Worksheets

Range("D10").Select
ActiveSheet.Paste

Next wSheet
End Sub



Greg Glynn

How to: copy value from active sheet to all other sheets with VBA(in desired cell)
 
Sub Button1_Click()
'
' Button1_Click Macro
'
Dim ws As Worksheet

MyVal = Range("C3")

For Each ws In Worksheets

ws.Range("C3").Value = MyVal
Next ws

End Sub

DVAL

How to: copy value from active sheet to all other sheets with VBA (in desired cell)
 
Thanks a lot!

with little change

Sub Button1_Click()
Dim ws As Worksheet
MyVal = Range("C3")
For Each ws In Worksheets
If Not ws.Name = Sheets(1).Name Then
ws.Range("d7").Value = MyVal
End If
Next ws
End Sub
works gr
works great!


"Greg Glynn" wrote in message
...
Sub Button1_Click()
'
' Button1_Click Macro
'
Dim ws As Worksheet

MyVal = Range("C3")

For Each ws In Worksheets

ws.Range("C3").Value = MyVal
Next ws

End Sub



[email protected]

How to: copy value from active sheet to all other sheets with VBA (in desired cell)
 
See added line of code below

On Tue, 14 Dec 2010 23:46:11 +0100, "DVAL" wrote:

Does anybody can help me?
I tried with command button
with macro:

Sub Button1_Click()
'
' Button1_Click Macro
'
Dim ws As Worksheet

Range("C3").Select
Selection.Copy
For Each ws In Worksheets

ws.select
Range("D10").Select
ActiveSheet.Paste

Next wSheet
End Sub




All times are GMT +1. The time now is 11:50 AM.

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