Write a value on all worksheets in the workbook

KhallP

Board Regular
Joined
Mar 30, 2021
Messages
157
Office Version
  1. 2016
Platform
  1. Windows
Good afternoon friends, is there any way to write a value in a specific cell on each sheet of the excel workbook using "Foreach" or in some other way?

Example: Write the number 3 in cell A3 of each sheet of the current workbook
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
How about
VBA Code:
Sub KhallP()
   With ActiveWorkbook.Worksheets
      Range("A3").Value = 3
      .FillAcrossSheets Range("A3"), xlFillWithAll
   End With
End Sub
 
Upvote 0
How about
VBA Code:
Sub KhallP()
   With ActiveWorkbook.Worksheets
      Range("A3").Value = 3
      .FillAcrossSheets Range("A3"), xlFillWithAll
   End With
End Sub
Sorry, I will specify better, I have a spreadsheet with 3 sheets ("Sheet1", "Sheet2", "Sheet3") on each sheet the intervals from A10 to A25 have different data and in cell C20 of each sheet the value will be result of the sum of the intervals A10 to A25 (all with different results on each sheet, that is, the result of cell C20 will always be different on each sheet)
 
Upvote 0
Then why on earth did you say
Write the number 3 in cell A3 of each sheet of the current workbook
which is absolutely nothing like what you appear to want?
 
Upvote 0
Not unless you explain clearly & accurately EXACTLY what you want.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top