Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Macro to affect all sheets

I want to select all sheets in a workbook, insert a column, and put a formula
in that column. It works fine when doing it manually, but if I try to have a
macro do this, it only affects one sheet. Is there any way to do this?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 561
Default Macro to affect all sheets

The general principal is shown in the following code.
Pls note: the code places the formula: =2+2 in cell F1 of every sheet.
I'm sure it will b no problem 4 u yo change it 4 your needs.
-----------------------
Sub All_Sheets()
For Each SH In ActiveWorkbook.Sheets
SH.[F1].Formula = "=2+2"
Next
End Sub
-------------
Micky


"REMB" wrote:

I want to select all sheets in a workbook, insert a column, and put a formula
in that column. It works fine when doing it manually, but if I try to have a
macro do this, it only affects one sheet. Is there any way to do this?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,522
Default Macro to affect all sheets


I know that it doesn't make sense but Excel will NOT accept all sheets in a
macro for this. Use the suggested loop. Fast
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"REMB" wrote in message
...
I want to select all sheets in a workbook, insert a column, and put a
formula
in that column. It works fine when doing it manually, but if I try to have
a
macro do this, it only affects one sheet. Is there any way to do this?


  #4   Report Post  
Junior Member
 
Posts: 2
Default

Quote:
Originally Posted by REMB View Post
I want to select all sheets in a workbook, insert a column, and put a formula
in that column. It works fine when doing it manually, but if I try to have a
macro do this, it only affects one sheet. Is there any way to do this?
Have you tried recording the Macro on Sheet 1 first, then holding down shift, and hilighting all tabs and running the Macro?
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting Rows and the affect on Functions Mike O. Excel Worksheet Functions 3 July 13th 09 11:56 PM
How does 1 value affect the average? Bruce Excel Worksheet Functions 3 October 26th 07 08:40 PM
How do business loans affect the p & l? Dvcdale Excel Discussion (Misc queries) 4 October 23rd 07 01:55 PM
How can I Run a query from VB macro with out affect current data in the same sheet? oafdl Excel Discussion (Misc queries) 0 May 29th 06 09:42 PM
inserta row and affect same formula on same sheet Jennifer Excel Worksheet Functions 1 March 11th 06 10:52 AM


All times are GMT +1. The time now is 05:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"